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

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

revision 1062 by dpavlin, Wed Nov 21 10:09:55 2007 UTC revision 1111 by dpavlin, Sat Sep 6 10:54:25 2008 UTC
# Line 6  our @EXPORT = qw/ Line 6  our @EXPORT = qw/
6          marc_duplicate marc_remove marc_count          marc_duplicate marc_remove marc_count
7          marc_original_order          marc_original_order
8          marc_template          marc_template
9            marc_clone
10  /;  /;
11    
12  use strict;  use strict;
# Line 572  sub marc_original_order { Line 573  sub marc_original_order {
573    
574          foreach my $d (@$r) {          foreach my $d (@$r) {
575    
576                    if ( ! ref($d) ) {
577                            # scalar
578                            warn "## marc_original_order($to,$from) skipped: ",dump( $d );
579                            next;
580                    }
581    
582                  if (! defined($d->{subfields}) && ref($d->{subfields}) ne 'ARRAY') {                  if (! defined($d->{subfields}) && ref($d->{subfields}) ne 'ARRAY') {
583                          warn "# marc_original_order($to,$from): field $from doesn't have subfields specification\n";                          warn "# marc_original_order($to,$from): field $from doesn't have subfields specification\n";
584                          next;                          next;
# Line 597  sub marc_original_order { Line 604  sub marc_original_order {
604                          } elsif ($offset == 0) {                          } elsif ($offset == 0) {
605                                  $v = $d->{$sf};                                  $v = $d->{$sf};
606                          } else {                          } else {
607                                  die "field $from subfield '$sf' need occurence $offset which doesn't exist", dump($d->{$sf});                                  die "field $from subfield '$sf' need occurence $offset which doesn't exist in ", dump($d);
608                          }                          }
609                          push @$m, ( $sf, $v ) if (defined($v));                          push @$m, ( $sf, $v ) if (defined($v));
610                  }                  }
# Line 623  sub marc_count { Line 630  sub marc_count {
630          return $#{ $marc_record };          return $#{ $marc_record };
631  }  }
632    
633    =head2 marc_clone
634    
635    Clone marc records from input file, whole or just some fields/indicators
636    
637      marc_clone;   # whole record
638    
639    =cut
640    
641    sub marc_clone {
642            warn "### marc_clone rec: ",dump( $rec ) if $debug > 2;
643            foreach my $f ( keys %$rec ) {
644                    warn "## marc_clone $f\n" if $debug;
645                    marc_original_order( $f, $f );
646            }
647    }
648    
649  =head1 PRIVATE FUNCTIONS  =head1 PRIVATE FUNCTIONS
650    
651  =head2 _marc_push  =head2 _marc_push

Legend:
Removed from v.1062  
changed lines
  Added in v.1111

  ViewVC Help
Powered by ViewVC 1.1.26