Catmandu::Importer::Pure - Package that imports Pure data.
# From the command line $ catmandu convert Pure --base https://purehost/ws/rest --endpoint publication # In Perl use Catmandu; my %attrs = ( base => 'http://host/path', endpoint => 'publication', ); my $importer = Catmandu->importer('Pure', %attrs); my $n = $importer->each(sub { my $hashref = $_[0]; # ... }); # get number of valid and approved publications my $count = Catmandu->importer( 'Pure', base => base, endpoint => 'publication', fullResponse => 1, options => { 'window.size' => 0, 'workflowState' => [ { '' => 'appproved', workflowName=> 'publication'}, { '' => 'validated', workflowName=> 'publication'}, ] } )->first->{count};
Catmandu::Importer::Pure is a Catmandu package that seamlessly imports data from Elsevier's Pure system using its REST service. Currently documentation describing the REST service can usually be viewed at /ws/doc/ on a host where Pure is installed, for instance, http://experts-us.demo.atira.dk/ws/doc/. ...
Base URL for the REST service is required, for example 'http://experts-us.demo.atira.dk/ws/rest'
Valid endpoint is required, like 'publications'
User name if basic authentication is used
Password if basic authentication is used
Options passed as parameters to the REST service, for example: { 'window.size' => 20, 'format' => 'xml_long', 'namespaces' => 'remove' }
Optional flag. If true delivers the complete results as a single item (record), corresponding to the XML response received. Only one request to the REST service is made in this case. Default is false.
If the flag is false then the items are set to child elements of the element 'result' or in case the 'result' element does not exist they are set to child elements of the root element for each response.
Handler to transform each record from XML DOM (XML::LibXML::Element) into Perl hash.
Handlers can be provided as function reference, an instance of a Perl package that implements 'parse', or by a package NAME. Package names should be prepended by + or prefixed with Catmandu::Importer::Pure::Parser. E.g foobar will create a Catmandu::Importer::Pure::Parser::foobar instance.
+
Catmandu::Importer::Pure::Parser
foobar
Catmandu::Importer::Pure::Parser::foobar
By default the handler Catmandu::Importer::Pure::Parser::simple is used. It provides a simple XML parsing, using XML::LibXML::Simple,
Other possible values are Catmandu::Importer::Pure::Parser::struct for XML::Struct based structure that preserves order and Catmandu::Importer::Pure::Parser::raw that returns the XML as it is.
HTTP user agent string, set to Mozilla/5.0 by default.
Mozilla/5.0
Instance of Furl or compatible class to fetch URLs with.
Timeout for HTTP requests in seonds. Defaults to 50.
Optional flag. If true then all text nodes in the REST response are trimmed so that any leading and trailing whitespace is removed before parsing. This is useful if you don't want to risk getting leading and trailing whitespace in your data, since Pure doesn't currently clean leading/trailing white space from user input. Note that there is a small performance penalty when using this option. Default is false.
Optional reference to function that processes the XML response before it is parsed. The argument to the function is a reference to the XML text, which is then used to modify it. This is option is normally not needed but can helpful if there is a problem parsing the response due to a bug in the REST service, for example.
In addition to methods inherited from Catmandu::Iterable, this module provides the following public methods:
Return the current Pure REST request URL (useful for debugging).
Catmandu::Importer
Catmandu::Iterable
Furl
http://librecat.org
Snorri Briem <briem@cpan.org>
Copyright 2017- Lund University Library
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Catmandu::Pure, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu::Pure
CPAN shell
perl -MCPAN -e shell install Catmandu::Pure
For more information on module installation, please visit the detailed CPAN module installation guide.