Datahub::Factory::Module::PID - Insert PIDS from an external source
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');
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.
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).
lwp
rcf
All options that have lwp in their name are used when lwp is selected as pid_module. Options with rcf are for rcf 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 or lwp protected with Basic Authentication, provide the username here. Is optional for lwp (no authentication is performed if this is empty).
pid_password
For lwp, provide the password. For rcf, 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.
path
Returns the location of the downloaded file (on the local system).
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.
/tmp
$csv_location
_id
$id_column
Returns nothing.
Pieter De Praetere <pieter at packed.be >
Copyright 2017- PACKED vzw
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Datahub::Factory Catmandu
To install Datahub::Factory::Arthub, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Datahub::Factory::Arthub
CPAN shell
perl -MCPAN -e shell install Datahub::Factory::Arthub
For more information on module installation, please visit the detailed CPAN module installation guide.