/[webpac2]/trunk/bin/dump2marc.pl
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/bin/dump2marc.pl

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

revision 1318 by dpavlin, Fri Nov 6 22:42:39 2009 UTC revision 1322 by dpavlin, Tue Jan 26 14:16:36 2010 UTC
# Line 9  use MARC::Record; Line 9  use MARC::Record;
9  use Data::Dump qw(dump);  use Data::Dump qw(dump);
10  use Encode;  use Encode;
11    
12    my $debug = 0;
13  my @fields;  my @fields;
14    
15  sub parse_subfields {  sub parse_subfields {
# Line 38  while(<>) { Line 39  while(<>) {
39          } elsif ( /^\s{7}_([a-z])(.+)$/ ) {          } elsif ( /^\s{7}_([a-z])(.+)$/ ) {
40                  push @{ $fields[ $#fields ] }, $1, $2;                  push @{ $fields[ $#fields ] }, $1, $2;
41          } elsif ( /^$/ ) {          } elsif ( /^$/ ) {
42                  warn dump( @fields );                  warn dump( @fields ) if $debug;
43    
44                  my $marc = new MARC::Record;                  my $marc = new MARC::Record;
45                  $marc->encoding( 'utf-8' );                  $marc->encoding( 'utf-8' );
46                  $marc->leader( $leader );                  $marc->leader( $leader );
47                  $marc->add_fields( @fields );                  $marc->add_fields( @fields );
48    
49                  warn $marc->as_formatted;                  warn $marc->as_formatted, $/, $/;
50                  print $marc->as_usmarc;                  print $marc->as_usmarc;
51    
52                  @fields = ();                  @fields = ();
53          } else {          } else {
54                  warn "IGNORED: $_\n";                  warn "IGNORED: $_\n" if $debug;
55          }          }
56    
57  }  }

Legend:
Removed from v.1318  
changed lines
  Added in v.1322

  ViewVC Help
Powered by ViewVC 1.1.26