/[Biblio-Isis]/trunk/lib/Biblio/Isis.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Biblio/Isis.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 57 by dpavlin, Sun Jul 9 12:12:57 2006 UTC revision 61 by dpavlin, Sun Jul 9 21:36:33 2006 UTC
# Line 7  use File::Glob qw(:globally :nocase); Line 7  use File::Glob qw(:globally :nocase);
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_1;
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 ();
# Line 519  There is also more elaborative way to ca Line 519  There is also more elaborative way to ca
519    my $hash = $isis->to_hash({    my $hash = $isis->to_hash({
520          mfn => 42,          mfn => 42,
521          include_subfields => 1,          include_subfields => 1,
522            regexps => [
523                    's/something/else/g',
524            ],
525    });    });
526    
527  Each option controll creation of hash:  Each option controll creation of hash:
# Line 544  have original record subfield order and Line 547  have original record subfield order and
547  =item join_subfields_with  =item join_subfields_with
548    
549  Define delimiter which will be used to join repeatable subfields. You can  Define delimiter which will be used to join repeatable subfields. You can
550  specify option here instead in L</new> if you want to have per-record controll.  specify option here instead in L</new> if you want to have per-record control.
551    
552  =back  =back
553    
# Line 562  sub to_hash { Line 565  sub to_hash {
565                  $mfn = $arg->{mfn} || confess "need mfn in arguments";                  $mfn = $arg->{mfn} || confess "need mfn in arguments";
566          }          }
567    
568            confess "regexps must be HASH" if ($arg->{regexps} && ref($arg->{regexps}) ne 'HASH');
569    
570          # init record to include MFN as field 000          # init record to include MFN as field 000
571          my $rec = { '000' => [ $mfn ] };          my $rec = { '000' => [ $mfn ] };
572    
573          my $row = $self->fetch($mfn) || return;          my $row = $self->fetch($mfn) || return;
574    
575          my $j_rs = $arg->{join_repeatable_subfields};          my $j_rs = $arg->{join_subfields_with};
576          $j_rs = $self->{join_repeatable_subfields} unless(defined($j_rs));          $j_rs = $self->{join_subfields_with} unless(defined($j_rs));
577          my $i_sf = $arg->{include_subfields};          my $i_sf = $arg->{include_subfields};
578    
579          foreach my $f_nr (keys %{$row}) {          foreach my $f_nr (keys %{$row}) {
# Line 580  sub to_hash { Line 585  sub to_hash {
585                                  next unless defined($l);                                  next unless defined($l);
586                          }                          }
587    
588                            # apply regexps
589                            if ($arg->{regexps} && defined($arg->{regexps}->{$f_nr})) {
590                                    confess "regexps->{$f_nr} must be ARRAY" if (ref($arg->{regexps}->{$f_nr}) ne 'ARRAY');
591                                    my $c = 0;
592                                    foreach my $r (@{ $arg->{regexps}->{$f_nr} }) {
593                                            while ( eval '$l =~ ' . $r ) { $c++ };
594                                    }
595                                    warn "## field $f_nr triggered $c regexpes\n" if ($c && $self->{debug});
596                            }
597    
598                          my $val;                          my $val;
599                          my $r_sf;       # repeatable subfields in this record                          my $r_sf;       # repeatable subfields in this record
600    
# Line 785  LICENSE file included with this module. Line 800  LICENSE file included with this module.
800    
801  =head1 SEE ALSO  =head1 SEE ALSO
802    
803    L<Biblio::Isis::Manual> for CDS/ISIS manual appendix F, G and H which describe file format
804    
805  OpenIsis web site L<http://www.openisis.org>  OpenIsis web site L<http://www.openisis.org>
806    
807  perl4lib site L<http://perl4lib.perl.org>  perl4lib site L<http://perl4lib.perl.org>

Legend:
Removed from v.57  
changed lines
  Added in v.61

  ViewVC Help
Powered by ViewVC 1.1.26