/[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 579 by dpavlin, Tue Jul 4 11:08:43 2006 UTC revision 586 by dpavlin, Thu Jul 6 10:31:13 2006 UTC
# 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 514  sub marc_compose { Line 516  sub marc_compose {
516                  warn "## ++ marc_compose($f,$sf,$v) ", dump( $m ),$/ if ($debug > 1);                  warn "## ++ marc_compose($f,$sf,$v) ", dump( $m ),$/ if ($debug > 1);
517          }          }
518    
519          warn "## marc_compose(d) ", dump( $m ),$/ if ($debug > 1);          warn "## marc_compose current marc = ", dump( $m ),$/ if ($debug > 1);
520    
521          push @{ $marc_record->[ $marc_record_offset ] }, $m if ($#{$m} > 2);          push @{ $marc_record->[ $marc_record_offset ] }, $m if ($#{$m} > 2);
522  }  }
# Line 660  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 769  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 '' } @_);          warn "### join_with('$d',",dump(@_),")\n" if ($debug > 2);
781            my $v = join($d, grep { defined($_) && $_ ne '' } @_);
782            return '' unless defined($v);
783            return $v;
784  }  }
785    
786  =head2 split_rec_on  =head2 split_rec_on

Legend:
Removed from v.579  
changed lines
  Added in v.586

  ViewVC Help
Powered by ViewVC 1.1.26