/[webpac2]/trunk/lib/WebPAC/Normalize.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/WebPAC/Normalize.pm

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

revision 574 by dpavlin, Mon Jul 3 21:08:07 2006 UTC revision 583 by dpavlin, Wed Jul 5 00:12:08 2006 UTC
# Line 35  WebPAC::Normalize - describe normalisato Line 35  WebPAC::Normalize - describe normalisato
35    
36  =head1 VERSION  =head1 VERSION
37    
38  Version 0.10  Version 0.11
39    
40  =cut  =cut
41    
42  our $VERSION = '0.10';  our $VERSION = '0.11';
43    
44  =head1 SYNOPSIS  =head1 SYNOPSIS
45    
# Line 326  sub _get_marc_fields { Line 326  sub _get_marc_fields {
326                  warn "## saved/3 ", dump( $field ),$/ if ($debug);                  warn "## saved/3 ", dump( $field ),$/ if ($debug);
327          }          }
328    
329          return @m;          return \@m;
330  }  }
331    
332  =head2 _debug  =head2 _debug
# Line 504  sub marc_compose { Line 504  sub marc_compose {
504          my ($i1,$i2) = defined($marc_indicators->{$f}) ? @{ $marc_indicators->{$f} } : (' ',' ');          my ($i1,$i2) = defined($marc_indicators->{$f}) ? @{ $marc_indicators->{$f} } : (' ',' ');
505          my $m = [ $f, $i1, $i2 ];          my $m = [ $f, $i1, $i2 ];
506    
507            warn "### marc_compose input subfields = ", dump(@_),$/ if ($debug > 2);
508    
509          while (@_) {          while (@_) {
510                  my $sf = shift or die "marc_compose $f needs subfield";                  my $sf = shift or die "marc_compose $f needs subfield";
511                  my $v = shift;                  my $v = shift;
# Line 565  sub marc_remove { Line 567  sub marc_remove {
567    
568          warn "### marc_remove before = ", dump( $marc ), $/ if ($debug > 2);          warn "### marc_remove before = ", dump( $marc ), $/ if ($debug > 2);
569    
570          foreach my $i ( 0 .. $#{ $marc } ) {          my $i = 0;
571            foreach ( 0 .. $#{ $marc } ) {
572                  last unless (defined $marc->[$i]);                  last unless (defined $marc->[$i]);
573                  warn "#### working on ",dump( @{ $marc->[$i] }), $/ if ($debug > 3);                  warn "#### working on ",dump( @{ $marc->[$i] }), $/ if ($debug > 3);
574                  if ($marc->[$i]->[0] eq $f) {                  if ($marc->[$i]->[0] eq $f) {
# Line 591  sub marc_remove { Line 594  sub marc_remove {
594                                  }                                  }
595                          }                          }
596                  }                  }
597                    $i++;
598          }          }
599    
600          warn "### marc_remove($f", $sf ? ",$sf" : "", ") after = ", dump( $marc ), $/ if ($debug > 2);          warn "### marc_remove($f", $sf ? ",$sf" : "", ") after = ", dump( $marc ), $/ if ($debug > 2);
# Line 658  syntaxtic sugar for Line 662  syntaxtic sugar for
662  =cut  =cut
663    
664  sub rec {  sub rec {
665            my @out;
666          if ($#_ == 0) {          if ($#_ == 0) {
667                  return rec1(@_);                  @out = rec1(@_);
668          } elsif ($#_ == 1) {          } elsif ($#_ == 1) {
669                  return rec2(@_);                  @out = rec2(@_);
670            }
671            if (@out) {
672                    return @out;
673            } else {
674                    return '';
675          }          }
676  }  }
677    
# Line 767  Joins walues with some delimiter Line 777  Joins walues with some delimiter
777    
778  sub join_with {  sub join_with {
779          my $d = shift;          my $d = shift;
780          return join($d, grep { defined($_) && $_ ne '' } @_);          my $v = join($d, grep { defined($_) && $_ ne '' } @_);
781            return '' unless defined($v);
782            return $v;
783  }  }
784    
785  =head2 split_rec_on  =head2 split_rec_on

Legend:
Removed from v.574  
changed lines
  Added in v.583

  ViewVC Help
Powered by ViewVC 1.1.26