7 |
BEGIN { |
BEGIN { |
8 |
use Exporter (); |
use Exporter (); |
9 |
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
10 |
$VERSION = 0.21; |
$VERSION = 0.22_2; |
11 |
@ISA = qw (Exporter); |
@ISA = qw (Exporter); |
12 |
#Give a hoot don't pollute, do not export more than needed by default |
#Give a hoot don't pollute, do not export more than needed by default |
13 |
@EXPORT = qw (); |
@EXPORT = qw (); |
89 |
}, |
}, |
90 |
debug => 1, |
debug => 1, |
91 |
join_subfields_with => ' ; ', |
join_subfields_with => ' ; ', |
92 |
|
regexps => [ |
93 |
|
's/something/else/g', |
94 |
|
], |
95 |
); |
); |
96 |
|
|
97 |
Options are described below: |
Options are described below: |
129 |
option is included to support lagacy application written against version |
option is included to support lagacy application written against version |
130 |
older than 0.21 of this module. By default, it disabled. See L</to_hash>. |
older than 0.21 of this module. By default, it disabled. See L</to_hash>. |
131 |
|
|
132 |
|
=item regexpes |
133 |
|
|
134 |
|
Define (any number) of regexpes to apply at field values before they are |
135 |
|
splitted into subfield. This is great place to split subfields in input to |
136 |
|
mulitple subfields if needed or rename subfields. |
137 |
|
|
138 |
=back |
=back |
139 |
|
|
140 |
=cut |
=cut |
528 |
my $hash = $isis->to_hash({ |
my $hash = $isis->to_hash({ |
529 |
mfn => 42, |
mfn => 42, |
530 |
include_subfields => 1, |
include_subfields => 1, |
531 |
|
regexps => [ |
532 |
|
's/something/else/g', |
533 |
|
], |
534 |
}); |
}); |
535 |
|
|
536 |
Each option controll creation of hash: |
Each option controll creation of hash: |
558 |
Define delimiter which will be used to join repeatable subfields. You can |
Define delimiter which will be used to join repeatable subfields. You can |
559 |
specify option here instead in L</new> if you want to have per-record control. |
specify option here instead in L</new> if you want to have per-record control. |
560 |
|
|
561 |
|
=item regexpes |
562 |
|
|
563 |
|
Override C<regexpes> specified in L</new>. |
564 |
|
|
565 |
=back |
=back |
566 |
|
|
567 |
=cut |
=cut |
578 |
$mfn = $arg->{mfn} || confess "need mfn in arguments"; |
$mfn = $arg->{mfn} || confess "need mfn in arguments"; |
579 |
} |
} |
580 |
|
|
581 |
|
$arg->{regexpes} ||= $self->{regexpes}; |
582 |
|
|
583 |
|
confess "regexps must be HASH" if ($arg->{regexps} && ref($arg->{regexps}) ne 'HASH'); |
584 |
|
|
585 |
# init record to include MFN as field 000 |
# init record to include MFN as field 000 |
586 |
my $rec = { '000' => [ $mfn ] }; |
my $rec = { '000' => [ $mfn ] }; |
587 |
|
|
600 |
next unless defined($l); |
next unless defined($l); |
601 |
} |
} |
602 |
|
|
603 |
|
# apply regexps |
604 |
|
if ($arg->{regexps} && defined($arg->{regexps}->{$f_nr})) { |
605 |
|
confess "regexps->{$f_nr} must be ARRAY" if (ref($arg->{regexps}->{$f_nr}) ne 'ARRAY'); |
606 |
|
my $c = 0; |
607 |
|
foreach my $r (@{ $arg->{regexps}->{$f_nr} }) { |
608 |
|
while ( eval '$l =~ ' . $r ) { $c++ }; |
609 |
|
} |
610 |
|
warn "## field $f_nr triggered $c regexpes\n" if ($c && $self->{debug}); |
611 |
|
} |
612 |
|
|
613 |
my $val; |
my $val; |
614 |
my $r_sf; # repeatable subfields in this record |
my $r_sf; # repeatable subfields in this record |
615 |
|
|
815 |
|
|
816 |
=head1 SEE ALSO |
=head1 SEE ALSO |
817 |
|
|
818 |
|
L<Biblio::Isis::Manual> for CDS/ISIS manual appendix F, G and H which describe file format |
819 |
|
|
820 |
OpenIsis web site L<http://www.openisis.org> |
OpenIsis web site L<http://www.openisis.org> |
821 |
|
|
822 |
perl4lib site L<http://perl4lib.perl.org> |
perl4lib site L<http://perl4lib.perl.org> |