This is an automated email from the git hooks/post-receive script. js pushed a commit to annotated tag upstream/1.19 in repository libcatmandu-marc-perl.
commit c86501032e4f7b88a74925fcce206ed1aaa18403 Author: Patrick Hochstenbach <[email protected]> Date: Thu Jun 23 15:04:08 2016 +0200 Create a more command line friendly documentation #16 --- lib/Catmandu/Exporter/MARC.pm | 51 +++++++++++++++++--------- lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm | 49 +++++++++++++------------ lib/Catmandu/Exporter/MARC/MARCMaker.pm | 40 +++++++++++---------- lib/Catmandu/Exporter/MARC/MiJ.pm | 40 +++++++++++---------- lib/Catmandu/Exporter/MARC/USMARC.pm | 40 +++++++++++---------- lib/Catmandu/Fix/Condition/marc_match.pm | 10 +++--- lib/Catmandu/Fix/marc_add.pm | 5 ++- lib/Catmandu/Fix/marc_in_json.pm | 3 +- lib/Catmandu/Fix/marc_map.pm | 3 +- lib/Catmandu/Fix/marc_remove.pm | 3 +- lib/Catmandu/Fix/marc_set.pm | 3 +- lib/Catmandu/Fix/marc_xml.pm | 5 ++- lib/Catmandu/Importer/MARC.pm | 61 ++++++++++++++++---------------- lib/Catmandu/Importer/MARC/ALEPHSEQ.pm | 35 +++++++++++++----- lib/Catmandu/Importer/MARC/Lint.pm | 43 ++++++++++++++-------- lib/Catmandu/Importer/MARC/MARCMaker.pm | 42 +++++++++++++++------- lib/Catmandu/Importer/MARC/MiJ.pm | 8 ++--- lib/Catmandu/Importer/MARC/MicroLIF.pm | 42 +++++++++++++++------- lib/Catmandu/Importer/MARC/RAW.pm | 40 ++++++++++++++------- lib/Catmandu/Importer/MARC/USMARC.pm | 38 ++++++++++++++------ lib/Catmandu/Importer/MARC/XML.pm | 42 +++++++++++++++------- 21 files changed, 370 insertions(+), 233 deletions(-) diff --git a/lib/Catmandu/Exporter/MARC.pm b/lib/Catmandu/Exporter/MARC.pm index d124a5a..eed2114 100644 --- a/lib/Catmandu/Exporter/MARC.pm +++ b/lib/Catmandu/Exporter/MARC.pm @@ -16,30 +16,47 @@ Catmandu::Exporter::MARC - Exporter for MARC records $exporter->add($importer); $exporter->commit; -=head1 METHODS +=head1 DESCRIPTION -=head2 new(file => $file, type => $type) +Catmandu::Exporter::MARC is a L<Catmandu::Exporter> to serialize (write) MARC records +to a file or the standard output. -Create a new L<Catmandu::Exporter> which serializes MARC records into a $file. -Type describes the MARC serializer to be used. Currently we support: +=head1 CONFIGURATION -=over 2 +=over -=item USMARC L<Catmandu::Exporter::MARC::USMARC> +=item type -=item ISO alias for USMARC +Create a new MARC exporter of the given type. Currently we support: -=item XML L<Catmandu::Exporter::MARC::XML> - -=item MARCMaker L<Catmandu::Exporter::MARC::MARCMaker> - -=item MiJ L<Catmandu::Exporter::MARC::MiJ> - -=item ALEPHSEQ L<Catmandu::Exporter::MARC::ALEPHSEQ> + USMARC L<Catmandu::Exporter::MARC::USMARC> + ISO alias for USMARC + XML L<Catmandu::Exporter::MARC::XML> + MARCMaker L<Catmandu::Exporter::MARC::MARCMaker> + MiJ L<Catmandu::Exporter::MARC::MiJ> (Marc in Json) + ALEPHSEQ L<Catmandu::Exporter::MARC::ALEPHSEQ> -=back +=item file + +Write output to a local file given by its path or file handle. Alternatively a +scalar reference can be passed to write to a string and a code reference can be +used to write to a callback function. + +=item fh + +Write the output to an L<IO::Handle>. If not specified, +L<Catmandu::Util::io|Catmandu::Util/IO-functions> is used to create the output +handle from the C<file> argument or by using STDOUT. + +=item fix -Read the documentation of the parser modules for extra configuration options. +An ARRAY of one or more fixes or file scripts to be applied to exported items. + +=item encoding + +Binmode of the output stream C<fh>. Set to "C<:utf8>" by default. + +=back =head1 SEE ALSO @@ -59,7 +76,7 @@ has _exporter_args => (is => 'rwp', writer => '_set_exporter_args'); sub _build_exporter { my ($self) = @_; my $type = $self->type eq 'ISO' ? 'USMARC' : $self->type; - + my $pkg = Catmandu::Util::require_package($type,'Catmandu::Exporter::MARC'); $pkg->new($self->_exporter_args); diff --git a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm index 4487b49..c185105 100644 --- a/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm +++ b/lib/Catmandu/Exporter/MARC/ALEPHSEQ.pm @@ -4,7 +4,7 @@ Catmandu::Exporter::MARC::ALEPHSEQ - Exporter for MARC records to Ex Libris' Ale =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC to MARC --type ALEPHSEQ < /foo/data.mrc # From Perl @@ -16,33 +16,36 @@ Catmandu::Exporter::MARC::ALEPHSEQ - Exporter for MARC records to Ex Libris' Ale $exporter->add($importer); $exporter->commit; -=head1 METHODS +=head1 CONFIGURATION + +=over -=head2 new(file => $file , %opts) +=item file -Create a new L<Catmandu::Exporter> to serialize MARC record into Aleph sequential. Provide the path -of a $file to write exported records to. Optionally the following parameters can be -specified: +Write output to a local file given by its path or file handle. Alternatively a +scalar reference can be passed to write to a string and a code reference can be +used to write to a callback function. - record : the key containing the marc record (default: 'record') - record_format : optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON - skip_empty_subfields : skip fields which don't contain any data (default: false) +=item fh -=head1 INHERTED METHODS +Write the output to an L<IO::Handle>. If not specified, +L<Catmandu::Util::io|Catmandu::Util/IO-functions> is used to create the output +handle from the C<file> argument or by using STDOUT. -=head2 count +=item fix -=head2 add($hashref) +An ARRAY of one or more fixes or file scripts to be applied to exported items. -=head2 add_many($array) +=item encoding -=head2 add_many($iterator) +Binmode of the output stream C<fh>. Set to "C<:utf8>" by default. -=head2 add_many(sub {}) +=back -=head2 ... +=head1 METHODS -All the L<Catmandu::Exporter> methods are inherited. +See L<Catmandu::Exporter>, L<Catmandu::Addable>, L<Catmandu::Fixable>, +L<Catmandu::Counter>, and L<Catmandu::Logger> for a full list of methods. =head1 SEE ALSO @@ -66,18 +69,18 @@ has skip_empty_subfields => (is => 'ro' , default => sub { 0 }); sub add { my ($self,$data) = @_; - if ($self->record_format eq 'MARC-in-JSON') { + if ($self->record_format eq 'MARC-in-JSON') { $data = $self->_json_to_raw($data); } my $_id = sprintf("%-9.9d", $data->{_id} // 0); - my $record = $data->{$self->record}; + my $record = $data->{$self->record}; my @lines = (); for my $field (@$record) { my ($tag,$ind1,$ind2,@data) = @$field; - + $ind1 = ' ' unless defined $ind1; $ind2 = ' ' unless defined $ind2; @@ -85,10 +88,10 @@ sub add { next if $#data == -1; - # Joins are faster than perl string concatenation + # Joins are faster than perl string concatenation if (index($tag,'FMT') == 0 || index($tag,'00') == 0) { push @lines , join('', $_id , ' ' , $tag , $ind1 , $ind2 , ' L ', $data[1] ); - } + } elsif (index($tag,'LDR') == 0) { my $ldr = $data[1]; $ldr =~ s/ /^/og; @@ -114,4 +117,4 @@ sub commit { $self->fh->flush; } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Exporter/MARC/MARCMaker.pm b/lib/Catmandu/Exporter/MARC/MARCMaker.pm index 0e90745..84ecda9 100644 --- a/lib/Catmandu/Exporter/MARC/MARCMaker.pm +++ b/lib/Catmandu/Exporter/MARC/MARCMaker.pm @@ -4,7 +4,7 @@ Catmandu::Exporter::MARC::MARCMaker - Exporter for MARC records to USMARC =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type XML to MARC --type MARCMaker < /foo/data.mrc # From Perl @@ -16,32 +16,36 @@ Catmandu::Exporter::MARC::MARCMaker - Exporter for MARC records to USMARC $exporter->add($importer); $exporter->commit; -=head1 METHODS +=head1 CONFIGURATION + +=over -=head2 new(file => $file , %opts) +=item file -Create a new L<Catmandu::Exporter> to serialize MARC record into MARCMaker. Provide the path -of a $file to write exported records to. Optionally the following parameters can be -specified: +Write output to a local file given by its path or file handle. Alternatively a +scalar reference can be passed to write to a string and a code reference can be +used to write to a callback function. - record : the key containing the marc record (default: 'record') - record_format : optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON +=item fh -=head1 INHERTED METHODS +Write the output to an L<IO::Handle>. If not specified, +L<Catmandu::Util::io|Catmandu::Util/IO-functions> is used to create the output +handle from the C<file> argument or by using STDOUT. -=head2 count +=item fix -=head2 add($hashref) +An ARRAY of one or more fixes or file scripts to be applied to exported items. -=head2 add_many($array) +=item encoding -=head2 add_many($iterator) +Binmode of the output stream C<fh>. Set to "C<:utf8>" by default. -=head2 add_many(sub {}) +=back -=head2 ... +=head1 METHODS -All the L<Catmandu::Exporter> methods are inherited. +See L<Catmandu::Exporter>, L<Catmandu::Addable>, L<Catmandu::Fixable>, +L<Catmandu::Counter>, and L<Catmandu::Logger> for a full list of methods. =head1 SEE ALSO @@ -66,7 +70,7 @@ has record_format => (is => 'ro' , default => sub { 'raw'} ); sub add { my ($self, $data) = @_; - if ($self->record_format eq 'MARC-in-JSON') { + if ($self->record_format eq 'MARC-in-JSON') { $data = $self->_json_to_raw($data); } @@ -80,4 +84,4 @@ sub commit { $self->fh->flush; } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Exporter/MARC/MiJ.pm b/lib/Catmandu/Exporter/MARC/MiJ.pm index 1ffd2d9..9d73034 100644 --- a/lib/Catmandu/Exporter/MARC/MiJ.pm +++ b/lib/Catmandu/Exporter/MARC/MiJ.pm @@ -4,7 +4,7 @@ Catmandu::Exporter::MARC::MiJ - Exporter for MARC records to MARC in JSON =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type XML to MARC --type MiJ < /foo/data.mrc # From Perl @@ -16,32 +16,36 @@ Catmandu::Exporter::MARC::MiJ - Exporter for MARC records to MARC in JSON $exporter->add($importer); $exporter->commit; -=head1 METHODS +=head1 CONFIGURATION + +=over -=head2 new(file => $file , %opts) +=item file -Create a new L<Catmandu::Exporter> to serialize MARC record into MiJ. Provide the path -of a $file to write exported records to. Optionally the following parameters can be -specified: +Write output to a local file given by its path or file handle. Alternatively a +scalar reference can be passed to write to a string and a code reference can be +used to write to a callback function. - record : the key containing the marc record (default: 'record') - record_format : optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON +=item fh -=head1 INHERTED METHODS +Write the output to an L<IO::Handle>. If not specified, +L<Catmandu::Util::io|Catmandu::Util/IO-functions> is used to create the output +handle from the C<file> argument or by using STDOUT. -=head2 count +=item fix -=head2 add($hashref) +An ARRAY of one or more fixes or file scripts to be applied to exported items. -=head2 add_many($array) +=item encoding -=head2 add_many($iterator) +Binmode of the output stream C<fh>. Set to "C<:utf8>" by default. -=head2 add_many(sub {}) +=back -=head2 ... +=head1 METHODS -All the L<Catmandu::Exporter> methods are inherited. +See L<Catmandu::Exporter>, L<Catmandu::Addable>, L<Catmandu::Fixable>, +L<Catmandu::Counter>, and L<Catmandu::Logger> for a full list of methods. =head1 SEE ALSO @@ -66,7 +70,7 @@ has record_format => (is => 'ro' , default => sub { 'raw'} ); sub add { my ($self, $data) = @_; - if ($self->record_format eq 'MARC-in-JSON') { + if ($self->record_format eq 'MARC-in-JSON') { $data = $self->_json_to_raw($data); } @@ -80,4 +84,4 @@ sub commit { $self->fh->flush; } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Exporter/MARC/USMARC.pm b/lib/Catmandu/Exporter/MARC/USMARC.pm index eb86f22..ec0692d 100644 --- a/lib/Catmandu/Exporter/MARC/USMARC.pm +++ b/lib/Catmandu/Exporter/MARC/USMARC.pm @@ -4,7 +4,7 @@ Catmandu::Exporter::MARC::USMARC - Exporter for MARC records to USMARC =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type XML to MARC --type USMARC < /foo/data.mrc # From Perl @@ -16,32 +16,36 @@ Catmandu::Exporter::MARC::USMARC - Exporter for MARC records to USMARC $exporter->add($importer); $exporter->commit; -=head1 METHODS +=head1 CONFIGURATION + +=over -=head2 new(file => $file , %opts) +=item file -Create a new L<Catmandu::Exporter> to serialize MARC record into USMARC. Provide the path -of a $file to write exported records to. Optionally the following parameters can be -specified: +Write output to a local file given by its path or file handle. Alternatively a +scalar reference can be passed to write to a string and a code reference can be +used to write to a callback function. - record : the key containing the marc record (default: 'record') - record_format : optionally set to 'MARC-in-JSON' when the input format is in MARC-in-JSON +=item fh -=head1 INHERTED METHODS +Write the output to an L<IO::Handle>. If not specified, +L<Catmandu::Util::io|Catmandu::Util/IO-functions> is used to create the output +handle from the C<file> argument or by using STDOUT. -=head2 count +=item fix -=head2 add($hashref) +An ARRAY of one or more fixes or file scripts to be applied to exported items. -=head2 add_many($array) +=item encoding -=head2 add_many($iterator) +Binmode of the output stream C<fh>. Set to "C<:utf8>" by default. -=head2 add_many(sub {}) +=back -=head2 ... +=head1 METHODS -All the L<Catmandu::Exporter> methods are inherited. +See L<Catmandu::Exporter>, L<Catmandu::Addable>, L<Catmandu::Fixable>, +L<Catmandu::Counter>, and L<Catmandu::Logger> for a full list of methods. =head1 SEE ALSO @@ -66,7 +70,7 @@ has record_format => (is => 'ro' , default => sub { 'raw'} ); sub add { my ($self, $data) = @_; - if ($self->record_format eq 'MARC-in-JSON') { + if ($self->record_format eq 'MARC-in-JSON') { $data = $self->_json_to_raw($data); } @@ -80,4 +84,4 @@ sub commit { $self->fh->flush; } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Fix/Condition/marc_match.pm b/lib/Catmandu/Fix/Condition/marc_match.pm index ea30c17..a547d10 100644 --- a/lib/Catmandu/Fix/Condition/marc_match.pm +++ b/lib/Catmandu/Fix/Condition/marc_match.pm @@ -42,17 +42,17 @@ sub emit { Catmandu::Fix::Condition::marc_match - Conditionals on MARC fields =head1 SYNOPSIS - + # marc_match(MARC_PATH,REGEX) - + if marc_match('245','My funny title') add_field('my.funny.title','true') end =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Evaluate the enclosing fixes only if the MARC (sub)field matches a +regular expression. =head1 SEE ALSO @@ -60,4 +60,4 @@ L<Catmandu::Fix> =cut -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Fix/marc_add.pm b/lib/Catmandu/Fix/marc_add.pm index c47a969..ee6c2c1 100644 --- a/lib/Catmandu/Fix/marc_add.pm +++ b/lib/Catmandu/Fix/marc_add.pm @@ -66,7 +66,7 @@ sub fix { =head1 NAME -Catmandu::Fix::marc_add - add new fields to marc +Catmandu::Fix::marc_add - add new fields to marc =head1 SYNOPSIS @@ -81,8 +81,7 @@ Catmandu::Fix::marc_add - add new fields to marc =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Add a new subfield to MARC record. =head1 SEE ALSO diff --git a/lib/Catmandu/Fix/marc_in_json.pm b/lib/Catmandu/Fix/marc_in_json.pm index 8415b90..3c7bb50 100644 --- a/lib/Catmandu/Fix/marc_in_json.pm +++ b/lib/Catmandu/Fix/marc_in_json.pm @@ -120,8 +120,7 @@ Catmandu::Fix::marc_in_json - transform a Catmandu MARC record into MARC-in-JSON =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Convert the MARC record into MARC-in-JSON format =head1 SEE ALSO diff --git a/lib/Catmandu/Fix/marc_map.pm b/lib/Catmandu/Fix/marc_map.pm index e7c30dc..82fb109 100644 --- a/lib/Catmandu/Fix/marc_map.pm +++ b/lib/Catmandu/Fix/marc_map.pm @@ -218,8 +218,7 @@ Catmandu::Fix::marc_map - copy marc values of one field to a new field =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Copy data from a MARC record to a field. =head1 SEE ALSO diff --git a/lib/Catmandu/Fix/marc_remove.pm b/lib/Catmandu/Fix/marc_remove.pm index 1f2c14d..62a048d 100644 --- a/lib/Catmandu/Fix/marc_remove.pm +++ b/lib/Catmandu/Fix/marc_remove.pm @@ -123,8 +123,7 @@ Catmandu::Fix::marc_remove - remove marc (sub)fields =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Remove (sub)fields in a MARC record =head1 SEE ALSO diff --git a/lib/Catmandu/Fix/marc_set.pm b/lib/Catmandu/Fix/marc_set.pm index 09f5bea..b9fd190 100644 --- a/lib/Catmandu/Fix/marc_set.pm +++ b/lib/Catmandu/Fix/marc_set.pm @@ -146,8 +146,7 @@ Catmandu::Fix::marc_set - set a marc value of one (sub)field to a new value =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Set the value of a MARC subfield to a new value. =head1 SEE ALSO diff --git a/lib/Catmandu/Fix/marc_xml.pm b/lib/Catmandu/Fix/marc_xml.pm index 5a654d4..50de351 100644 --- a/lib/Catmandu/Fix/marc_xml.pm +++ b/lib/Catmandu/Fix/marc_xml.pm @@ -34,13 +34,12 @@ Catmandu::Fix::marc_xml - transform a Catmandu MARC record into MARCXML =head1 SYNOPSIS - # Transforms the 'record' key into an MARCXML string + # Transforms the 'record' key into a MARCXML string marc_xml('record') =head1 DESCRIPTION -Read our Wiki pages at L<https://github.com/LibreCat/Catmandu/wiki/Fixes> for a complete -overview of the Fix language. +Convert MARC data into a MARCXML string =head1 SEE ALSO diff --git a/lib/Catmandu/Importer/MARC.pm b/lib/Catmandu/Importer/MARC.pm index de0d117..4de7a19 100644 --- a/lib/Catmandu/Importer/MARC.pm +++ b/lib/Catmandu/Importer/MARC.pm @@ -30,10 +30,10 @@ Catmandu::Importer::MARC - Package that imports MARC data =head1 DESCRIPTION Catmandu::Importer::MARC is a L<Catmandu::Iterable> to import MARC records from an -external source. When given an input file an Catmandu::Iterable is create generating +external source. When given an input file an Catmandu::Iterable is create generating items as perl HASH-es containing two keys: - '_id' : the system identifier of the record (usually the 001 field) + '_id' : the system identifier of the record (usually the 001 field) 'record' : an ARRAY of ARRAYs containing the record data Read more about processing data with Catmandu on the wiki: L<https://github.com/LibreCat/Catmandu/wiki> @@ -62,53 +62,52 @@ Read more about processing data with Catmandu on the wiki: L<https://github.com/ '_id' => 'fol05882032' } -=head1 METHODS +=head1 CONFIGURATION -=head2 new(file => $filename, type => $type) +=over -Create a new MARC importer for $filename. Use STDIN when no filename is given. -Type describes the MARC parser to be used. Currently we support: +=item type -=over 2 +Create a new MARC importer of the given type. Currently we support: -=item USMARC L<Catmandu::Importer::MARC::USMARC> + USMARC L<Catmandu::Importer::MARC::USMARC> + ISO alias for USMARC + MicroLIF L<Catmandu::Importer::MARC::MicroLIF> + MARCMaker L<Catmandu::Importer::MARC::MARCMaker> + MiJ L<Catmandu::Importer::MARC::MiJ> + XML L<Catmandu::Importer::MARC::XML> + RAW L<Catmandu::Importer::MARC::RAW> + Lint L<Catmandu::Importer::MARC::Lint> + ALEPHSEQ L<Catmandu::Importer::MARC::ALEPHSEQ> -=item ISO alias for USMARC +=item file -=item MicroLIF L<Catmandu::Importer::MARC::MicroLIF> +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -=item MARCMaker L<Catmandu::Importer::MARC::MARCMaker> +=item fh -=item JSON L<Catmandu::Importer::MARC::MiJ> +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=item XML L<Catmandu::Importer::MARC::XML> +=item encoding -=item RAW L<Catmandu::Importer::MARC::RAW> +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=item Lint L<Catmandu::Importer::MARC::Lint> +=item fix -=item ALEPHSEQ L<Catmandu::Importer::MARC::ALEPHSEQ> +An ARRAY of one or more fixes or file scripts to be applied to imported items. =back -Read the documentation of the parser modules for extra configuration options. - -=head1 INHERTED METHODS - -=head2 count - -=head2 each(&callback) - -=head2 ... +=head1 METHODS -Every L<Catmandu::Importer> is a L<Catmandu::Iterable> all its methods are inherited. +Every L<Catmandu::Importer> is a L<Catmandu::Iterable> all its methods are inherited. =head1 SEE ALSO L<Catmandu::Importer>, -L<Catmandu::Iterable>, -L<Catmandu::Fix::marc_map> , -L<Catmandu::Fix::marc_xml> +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC; @@ -129,7 +128,7 @@ sub _build_importer { my $type = $self->type eq 'ISO' ? 'USMARC' : $self->type; $type = 'Record' if exists $self->_importer_args->{records}; - + my $pkg = Catmandu::Util::require_package($type,'Catmandu::Importer::MARC'); $pkg->new($self->_importer_args); @@ -141,4 +140,4 @@ sub BUILD { } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/ALEPHSEQ.pm b/lib/Catmandu/Importer/MARC/ALEPHSEQ.pm index 6cbb56c..6c16181 100644 --- a/lib/Catmandu/Importer/MARC/ALEPHSEQ.pm +++ b/lib/Catmandu/Importer/MARC/ALEPHSEQ.pm @@ -26,21 +26,38 @@ Catmandu::Importer::MARC::ALEPHSEQ - Package that imports Ex Libris' Aleph seque printf "title: %s\n" , $item->{title}; }); -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item file + +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. + +=item fh -=head2 new(file => $file , fh => $fh) +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -Parse a file or a filehandle into a L<Catmandu::Iterable>. +=item encoding -=head1 INHERTED METHODS +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=head2 count +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -=head2 each(&callback) +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. -=head2 ... +=head1 SEE ALSO -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::ALEPHSEQ; @@ -117,4 +134,4 @@ sub generator { } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/Lint.pm b/lib/Catmandu/Importer/MARC/Lint.pm index 026b729..b9df4a6 100644 --- a/lib/Catmandu/Importer/MARC/Lint.pm +++ b/lib/Catmandu/Importer/MARC/Lint.pm @@ -30,31 +30,46 @@ Catmandu::Importer::MARC::Lint - Package that imports USMARC records validated w All items produced with the Catmandu::Importer::MARC::Lint importer contain three keys: - '_id' : the system identifier of the record (usually the 001 field) + '_id' : the system identifier of the record (usually the 001 field) 'record' : an ARRAY of ARRAYs containing the record data 'lint' : the output of MARC::Lint's check_record on the MARC record -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item id + +The MARC field which contains the system id (default: 001) + +=item file -=head2 new(file => $file , fh => $fh , id => $field) +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -Parse a file or a filehandle into a L<Catmandu::Iterable>. Optionally provide an -id attribute specifying the source of the system identifer '_id' field (e.g. '001'). +=item fh -=head1 INHERTED METHODS +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=head2 count +=item encoding -=head2 each(&callback) +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=head2 ... +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO -L<MARC::File::USMARC>, -L<MARC::File::Lint>, +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::Lint; @@ -71,7 +86,7 @@ with 'Catmandu::Importer'; has id => (is => 'ro' , default => sub { '001' }); has decoder => ( is => 'ro', - lazy => 1 , + lazy => 1 , builder => sub { Catmandu::Importer::MARC::Decoder->new; } ); @@ -89,4 +104,4 @@ sub generator { } } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/MARCMaker.pm b/lib/Catmandu/Importer/MARC/MARCMaker.pm index e836532..10a669f 100644 --- a/lib/Catmandu/Importer/MARC/MARCMaker.pm +++ b/lib/Catmandu/Importer/MARC/MARCMaker.pm @@ -4,7 +4,7 @@ Catmandu::Importer::MARC::MARCMaker - Package that imports MARCMaker records =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type MARCMaker --fix "marc_map('245a','title')" < /foo/data.mrk # From perl @@ -26,26 +26,42 @@ Catmandu::Importer::MARC::MARCMaker - Package that imports MARCMaker records printf "title: %s\n" , $item->{title}; }); -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item id + +The MARC field which contains the system id (default: 001) + +=item file -=head2 new(file => $file , fh => $fh , id => $field) +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -Parse a file or a filehandle into a L<Catmandu::Iterable>. Optionally provide an -id attribute specifying the source of the system identifer '_id' field (e.g. '001'). +=item fh -=head1 INHERTED METHODS +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=head2 count +=item encoding -=head2 each(&callback) +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=head2 ... +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO -L<MARC::File::MARCMaker> +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::MARCMaker; @@ -61,7 +77,7 @@ with 'Catmandu::Importer'; has id => (is => 'ro' , default => sub { '001' }); has decoder => ( is => 'ro', - lazy => 1 , + lazy => 1 , builder => sub { Catmandu::Importer::MARC::Decoder->new; } ); @@ -74,4 +90,4 @@ sub generator { } } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/MiJ.pm b/lib/Catmandu/Importer/MARC/MiJ.pm index 4a9d565..3e96f75 100644 --- a/lib/Catmandu/Importer/MARC/MiJ.pm +++ b/lib/Catmandu/Importer/MARC/MiJ.pm @@ -4,7 +4,7 @@ Catmandu::Importer::MARC::MiJ - Package that imports MARC-in-JSON records =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type MiJ --fix "marc_map('245a','title')" < /foo/data.js # From perl @@ -41,7 +41,7 @@ id attribute specifying the source of the system identifer '_id' field (e.g. '00 =head2 ... -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO @@ -62,7 +62,7 @@ with 'Catmandu::Importer'; has id => (is => 'ro' , default => sub { '001' }); has decoder => ( is => 'ro', - lazy => 1 , + lazy => 1 , builder => sub { Catmandu::Importer::MARC::Decoder->new; } ); @@ -75,4 +75,4 @@ sub generator { } } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/MicroLIF.pm b/lib/Catmandu/Importer/MARC/MicroLIF.pm index 9041b14..1dd15c0 100644 --- a/lib/Catmandu/Importer/MARC/MicroLIF.pm +++ b/lib/Catmandu/Importer/MARC/MicroLIF.pm @@ -4,7 +4,7 @@ Catmandu::Importer::MARC::MicroLIF - Package that imports MicroLIF records =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type MicroLIF --fix "marc_map('245a','title')" < /foo/data.lif # From perl @@ -26,26 +26,42 @@ Catmandu::Importer::MARC::MicroLIF - Package that imports MicroLIF records printf "title: %s\n" , $item->{title}; }); -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item id + +The MARC field which contains the system id (default: 001) + +=item file -=head2 new(file => $file , fh => $fh , id => $field) +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -Parse a file or a filehandle into a L<Catmandu::Iterable>. Optionally provide an -id attribute specifying the source of the system identifer '_id' field (e.g. '001'). +=item fh -=head1 INHERTED METHODS +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=head2 count +=item encoding -=head2 each(&callback) +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=head2 ... +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO -L<MARC::File::MicroLIF> +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::MicroLIF; @@ -61,7 +77,7 @@ with 'Catmandu::Importer'; has id => (is => 'ro' , default => sub { '001' }); has decoder => ( is => 'ro', - lazy => 1 , + lazy => 1 , builder => sub { Catmandu::Importer::MARC::Decoder->new; } ); @@ -74,4 +90,4 @@ sub generator { } } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/RAW.pm b/lib/Catmandu/Importer/MARC/RAW.pm index 45f2292..e8b17fc 100644 --- a/lib/Catmandu/Importer/MARC/RAW.pm +++ b/lib/Catmandu/Importer/MARC/RAW.pm @@ -20,32 +20,48 @@ Catmandu::Importer::MARC::RAW - Package that imports ISO 2709 encoded MARC recor }); # or using the fixer - + $fixer->fix($importer)->each(sub { my $item = shift; printf "title: %s\n" , $item->{title}; }); -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item id + +The MARC field which contains the system id (default: 001) -=head2 new(file => $file , fh => $fh , id => $field) +=item file -Parse a file or a filehandle into a L<Catmandu::Iterable>. Optionally provide an -id attribute specifying the source of the system identifer '_id' field (e.g. '001'). +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -=head1 INHERTED METHODS +=item fh -=head2 count +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=head2 each(&callback) +=item encoding -=head2 ... +Binmode of the input stream C<fh>. Set to C<:utf8> by default. + +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO -L<MARC::Parser::RAW> +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::RAW; @@ -81,4 +97,4 @@ sub generator { } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/USMARC.pm b/lib/Catmandu/Importer/MARC/USMARC.pm index e66910e..e52b301 100644 --- a/lib/Catmandu/Importer/MARC/USMARC.pm +++ b/lib/Catmandu/Importer/MARC/USMARC.pm @@ -26,26 +26,42 @@ Catmandu::Importer::MARC::USMARC - Package that imports USMARC records printf "title: %s\n" , $item->{title}; }); -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item id + +The MARC field which contains the system id (default: 001) + +=item file -=head2 new(file => $file , fh => $fh , id => $field) +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -Parse a file or a filehandle into a L<Catmandu::Iterable>. Optionally provide an -id attribute specifying the source of the system identifer '_id' field (e.g. '001'). +=item fh -=head1 INHERTED METHODS +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=head2 count +=item encoding -=head2 each(&callback) +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=head2 ... +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO -L<MARC::File::USMARC> +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::USMARC; @@ -110,4 +126,4 @@ sub decode_marc { return { _id => $sysid , record => \@result }; } -1; \ No newline at end of file +1; diff --git a/lib/Catmandu/Importer/MARC/XML.pm b/lib/Catmandu/Importer/MARC/XML.pm index a6aa7f8..62e7631 100644 --- a/lib/Catmandu/Importer/MARC/XML.pm +++ b/lib/Catmandu/Importer/MARC/XML.pm @@ -4,7 +4,7 @@ Catmandu::Importer::MARC::XML - Package that imports MARCXML records =head1 SYNOPSIS - # From the command line + # From the command line $ catmandu convert MARC --type XML --fix "marc_map('245a','title')" < /foo/data.xml # From perl @@ -26,26 +26,42 @@ Catmandu::Importer::MARC::XML - Package that imports MARCXML records printf "title: %s\n" , $item->{title}; }); -=head1 METHODS +=head1 CONFIGURATION + +=over + +=item id + +The MARC field which contains the system id (default: 001) + +=item file -=head2 new(file => $file , fh => $fh , id => $field) +Read input from a local file given by its path. Alternatively a scalar +reference can be passed to read from a string. -Parse a file or a filehandle into a L<Catmandu::Iterable>. Optionally provide an -id attribute specifying the source of the system identifer '_id' field (e.g. '001'). +=item fh -=head1 INHERTED METHODS +Read input from an L<IO::Handle>. If not specified, L<Catmandu::Util::io> is used to +create the input stream from the C<file> argument or by using STDIN. -=head2 count +=item encoding -=head2 each(&callback) +Binmode of the input stream C<fh>. Set to C<:utf8> by default. -=head2 ... +=item fix + +An ARRAY of one or more fixes or file scripts to be applied to imported items. + +=back + +=head1 METHODS -Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. +Every Catmandu::Importer is a Catmandu::Iterable all its methods are inherited. =head1 SEE ALSO -L<MARC::File::XML> +L<Catmandu::Importer>, +L<Catmandu::Iterable> =cut package Catmandu::Importer::MARC::XML; @@ -61,7 +77,7 @@ with 'Catmandu::Importer'; has id => (is => 'ro' , default => sub { '001' }); has decoder => ( is => 'ro', - lazy => 1 , + lazy => 1 , builder => sub { Catmandu::Importer::MARC::Decoder->new; } ); @@ -74,4 +90,4 @@ sub generator { } } -1; \ No newline at end of file +1; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcatmandu-marc-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
