NAME
Datahub::Factory::Module::PID - Insert PIDS from an external source
SYNOPSIS
use Datahub::Factory;
my $pid = Datahub::Factory->module('PID')->new(
pid_module => 'lwp',
pid_username => 'datahub',
pid_password => 'datahub',
pid_lwp_realm => 'thedatahub',
pid_lwp_url => 'https://my.endpoint.org/files/'
);
$pid->temporary_table($pid->path, 'id');
DESCRIPTION
The module uses Catmandu to create a SQLite database from a CSV containing an export of the Resolver that can be used in Catmandu fixes to insert PIDS (Persistent Identifiers).
The CSV's can be fetched from a protected Rackspace CloudFiles instance or from a (supports Basic Authentication) simple web address.
It has absolutely no use outside of the Datahub use case.
PARAMETERS
pid_module
-
(default:
lwp
) select the module to fetch the CSV files: supports a simple web site (lwp
), optionally protected by Basic Authentication; or Rackspace Cloud Files (rcf
).All options that have
lwp
in their name are used whenlwp
is selected as pid_module. Options withrcf
are forrcf
only. Options with neither are for the entire module.You only have to provide the username, password and realm for
lwp
if you are using Basic Authentication. If not, you can leave them blank. pid_lwp_url
-
Provide the URL to fetch the file from. Required for
lwp
. pid_username
-
If you are using
rcf
orlwp
protected with Basic Authentication, provide the username here. Is optional forlwp
(no authentication is performed if this is empty). pid_password
-
For
lwp
, provide the password. Forrcf
, provide the API key. pid_lwp_realm
-
Optionally, provide the realm for
lwp
Basic Authentication. pid_rcf_container_name
-
If you have selected
rcf
, provide the container name here. pid_rcf_object
-
For
rcf
, enter the name of the object you want to fetch (e.g. the file) here.
ATTRIBUTES
path
-
Returns the location of the downloaded file (on the local system).
METHODS
temporary_table($csv_location, $id_column)
-
Create a SQLite database (in
/tmp
) that stores the CSV that is stored in$csv_location
. Create an_id
column (as expected by Catmandu::Fix::lookup_in_store) in the database from the column in the CSV called$id_column
.Returns nothing.
AUTHOR
Pieter De Praetere <pieter at packed.be >
COPYRIGHT
Copyright 2017- PACKED vzw
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.