/[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 605 by dpavlin, Sun Jul 30 14:23:23 2006 UTC revision 616 by dpavlin, Wed Aug 23 14:29:43 2006 UTC
# Line 36  WebPAC::Normalize - describe normalisato Line 36  WebPAC::Normalize - describe normalisato
36    
37  =head1 VERSION  =head1 VERSION
38    
39  Version 0.15  Version 0.16
40    
41  =cut  =cut
42    
43  our $VERSION = '0.15';  our $VERSION = '0.16';
44    
45  =head1 SYNOPSIS  =head1 SYNOPSIS
46    
# Line 646  sub marc_remove { Line 646  sub marc_remove {
646    
647  Copy all subfields preserving original order to marc field.  Copy all subfields preserving original order to marc field.
648    
649    marc_original_order(210, 260);    marc_original_order( marc_field_number, original_input_field_number );
650    
651    Please note that field numbers are consistent with other commands (marc
652    field number first), but somewhat counter-intuitive (destination and then
653    source).
654    
655  You might want to use this command if you are just renaming subfields or  You might want to use this command if you are just renaming subfields or
656  using pre-processing modify_record in C<config.yml> and don't need any  using pre-processing modify_record in C<config.yml> and don't need any
657  post-processing or want to preserve order of original subfields.  post-processing or want to preserve order of original subfields.
658    
659    
660  =cut  =cut
661    
662  sub marc_original_order {  sub marc_original_order {
663    
664          my ($from, $to) = @_;          my ($to, $from) = @_;
665          die "marc_original_order needs from and to fields\n" unless ($from && $to);          die "marc_original_order needs from and to fields\n" unless ($from && $to);
666    
667          my $r = $rec->{$from} || return;          return unless defined($rec->{$from});
668    
669            my $r = $rec->{$from};
670          die "record field $from isn't array\n" unless (ref($r) eq 'ARRAY');          die "record field $from isn't array\n" unless (ref($r) eq 'ARRAY');
671    
672          my ($i1,$i2) = defined($marc_indicators->{$to}) ? @{ $marc_indicators->{$to} } : (' ',' ');          my ($i1,$i2) = defined($marc_indicators->{$to}) ? @{ $marc_indicators->{$to} } : (' ',' ');
673          warn "## marc_original_order($from,$to) source = ", dump( $r ),$/ if ($debug > 1);          warn "## marc_original_order($to,$from) source = ", dump( $r ),$/ if ($debug > 1);
674    
675          foreach my $d (@$r) {          foreach my $d (@$r) {
676    
677                  if (! defined($d->{subfields}) && ref($d->{subfields}) ne 'ARRAY') {                  if (! defined($d->{subfields}) && ref($d->{subfields}) ne 'ARRAY') {
678                          warn "# marc_original_order($from,$to): field $from doesn't have subfields specification\n";                          warn "# marc_original_order($to,$from): field $from doesn't have subfields specification\n";
679                          next;                          next;
680                  }                  }
681                    

Legend:
Removed from v.605  
changed lines
  Added in v.616

  ViewVC Help
Powered by ViewVC 1.1.26