Plack-App-Catmandu-OAI
view release on metacpan or search on metacpan
"dist_name" => "Plack-App-Catmandu-OAI",
"dist_version" => "0.02",
"license" => "perl",
"module_name" => "Plack::App::Catmandu::OAI",
"recommends" => {
"Type::Tiny::XS" => 0
},
"recursive_test_files" => 1,
"requires" => {
"Catmandu" => "1.20",
"Catmandu::Exporter::Template" => "0.11",
"Data::MessagePack" => 0,
"DateTime" => 0,
"DateTime::Format::ISO8601" => 0,
"DateTime::Format::Strptime" => 0,
"MIME::Base64" => 0,
"Moo" => 0,
"Plack" => 0,
"Try::Tiny" => 0,
"Type::Tiny" => 0,
"namespace::clean" => 0,
"Dist::Milla" : "v1.0.22",
"Test::Pod" : "1.41"
}
},
"runtime" : {
"recommends" : {
"Type::Tiny::XS" : "0"
},
"requires" : {
"Catmandu" : "1.20",
"Catmandu::Exporter::Template" : "0.11",
"Data::MessagePack" : "0",
"DateTime" : "0",
"DateTime::Format::ISO8601" : "0",
"DateTime::Format::Strptime" : "0",
"MIME::Base64" : "0",
"Moo" : "0",
"Plack" : "0",
"Try::Tiny" : "0",
"Type::Tiny" : "0",
"namespace::clean" : "0",
- eg
- examples
- inc
- share
- t
- xt
recommends:
Type::Tiny::XS: '0'
requires:
Catmandu: '1.20'
Catmandu::Exporter::Template: '0.11'
Data::MessagePack: '0'
DateTime: '0'
DateTime::Format::ISO8601: '0'
DateTime::Format::Strptime: '0'
MIME::Base64: '0'
Moo: '0'
Plack: '0'
Try::Tiny: '0'
Type::Tiny: '0'
namespace::clean: '0'
Type: non empty string
Description: datestamp pattern for OAI parameters from and until.
Example: %Y-%m-%dT%H:%M:%SZ
Required: true
template_options
An optional hash of configuration options that will be passed to
Catmandu::Exporter::Template or Template
As this is meant as a drop in replacement for
Dancer::Plugin::Catmandu::OAI all arguments should be the same.
So all arguments can be taken from your previous dancer plugin
configuration, if necessary:
use Dancer;
use Catmandu;
use Plack::Builder;
requires 'perl', 'v5.20.0';
on test => sub {
requires 'Test::More', '0.88';
};
requires 'Plack';
requires 'Catmandu', '>=1.20';
requires 'Catmandu::Exporter::Template', '0.11';
requires 'Type::Tiny';
requires 'Try::Tiny';
requires 'Moo';
requires 'Data::MessagePack';
requires 'MIME::Base64';
requires 'DateTime';
requires 'DateTime::Format::ISO8601';
requires 'DateTime::Format::Strptime';
requires 'namespace::clean';
lib/Plack/App/Catmandu/OAI.pm view on Meta::CPAN
our $VERSION = '0.02';
use Catmandu::Sane;
use Catmandu::Util qw(:is io);
use Catmandu::Error;
use Catmandu;
use Moo;
use Types::Standard qw(Str ArrayRef HashRef Enum Int CodeRef ScalarRef);
use Types::Common::String qw(NonEmptyStr);
use Types::Common::Numeric qw(PositiveInt);
use Catmandu::Exporter::Template;
use Catmandu::Fix;
use Data::MessagePack;
use MIME::Base64 qw(encode_base64url decode_base64url);
use DateTime;
use DateTime::Format::ISO8601;
use DateTime::Format::Strptime;
use Try::Tiny;
use Plack::Request;
use namespace::clean;
use feature qw(signatures);
lib/Plack/App/Catmandu/OAI.pm view on Meta::CPAN
$template_list_sets .= <<TT;
</ListSets>
$template_footer
TT
$self->_templ_list_sets(\$template_list_sets);
}
sub _tt_process ($self, $tmpl, $data) {
my $out = "";
open my $fh, '>:utf8', \$out;
my $exporter = Catmandu::Exporter::Template->new(
template => $tmpl,
fh => $fh,
);
$exporter->add($data);
$exporter->commit;
$out;
}
sub _render ($self, $body) {
[200, ['Content-Type' => 'application/xml; charset=utf-8'], [$body]];
lib/Plack/App/Catmandu/OAI.pm view on Meta::CPAN
if (defined $rec) {
if ($self->fix) {
$rec = $self->fix->fix($rec);
}
$vars->{id} = $id;
$vars->{datestamp} = $self->_datestamp_formatter->($rec->{$self->datestamp_field()});
$vars->{deleted} = $self->deleted->($rec);
$vars->{setSpec} = $self->set_specs_for->($rec);
my $metadata = "";
my $exporter = Catmandu::Exporter::Template->new(
%{$self->template_options},
template => $format->{template},
file => \$metadata,
);
if ($format->{fix}) {
$rec = $format->{fix}->fix($rec);
}
$exporter->add($rec);
$exporter->commit;
$vars->{metadata} = $metadata;
lib/Plack/App/Catmandu/OAI.pm view on Meta::CPAN
my $rec_vars = {
id => $id,
datestamp => $self->_datestamp_formatter->(
$rec->{$self->datestamp_field()}
),
deleted => $deleted,
setSpec => $self->set_specs_for->($rec),
};
unless ($deleted) {
my $metadata = "";
my $exporter = Catmandu::Exporter::Template->new(
%{$self->template_options},
template => $format->{template},
file => \$metadata,
);
if ($format->{fix}) {
$rec = $format->{fix}->fix($rec);
}
$exporter->add($rec);
$exporter->commit;
$rec_vars->{metadata} = $metadata;
lib/Plack/App/Catmandu/OAI.pm view on Meta::CPAN
=item datestamp_pattern
Type: non empty string
Description: datestamp pattern for OAI parameters C<from> and C<until>. Example: C<%Y-%m-%dT%H:%M:%SZ>
Required: true
=item template_options
An optional hash of configuration options that will be passed to L<Catmandu::Exporter::Template> or L<Template>
=back
As this is meant as a drop in replacement for L<Dancer::Plugin::Catmandu::OAI> all arguments should be the same.
So all arguments can be taken from your previous dancer plugin configuration, if necessary:
use Dancer;
use Catmandu;
use Plack::Builder;
( run in 0.553 second using v1.01-cache-2.11-cpan-0f795438458 )