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

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

revision 558 by dpavlin, Sun Jul 2 10:27:06 2006 UTC revision 576 by dpavlin, Mon Jul 3 22:12:13 2006 UTC
# Line 77  Optional path to output file Line 77  Optional path to output file
77  By default turned on if C<--marc-normalize> is used. You can disable lint  By default turned on if C<--marc-normalize> is used. You can disable lint
78  messages with C<--no-marc-lint>.  messages with C<--no-marc-lint>.
79    
80    =item --marc-dump
81    
82    Force dump or input and marc record for debugging.
83    
84  =back  =back
85    
86  =cut  =cut
# Line 92  my $stats = 0; Line 96  my $stats = 0;
96  my $validate_path;  my $validate_path;
97  my ($marc_normalize, $marc_output);  my ($marc_normalize, $marc_output);
98  my $marc_lint = 1;  my $marc_lint = 1;
99    my $marc_dump = 0;
100    
101  GetOptions(  GetOptions(
102          "limit=i" => \$limit,          "limit=i" => \$limit,
# Line 100  GetOptions( Line 105  GetOptions(
105          "one=s" => \$only_filter,          "one=s" => \$only_filter,
106          "only=s" => \$only_filter,          "only=s" => \$only_filter,
107          "config" => \$config,          "config" => \$config,
108          "debug" => \$debug,          "debug+" => \$debug,
109          "stats" => \$stats,          "stats" => \$stats,
110          "validate=s" => \$validate_path,          "validate=s" => \$validate_path,
111          "marc-normalize=s" => \$marc_normalize,          "marc-normalize=s" => \$marc_normalize,
112          "marc-output=s" => \$marc_output,          "marc-output=s" => \$marc_output,
113          "marc-lint!" => \$marc_lint,          "marc-lint!" => \$marc_lint,
114            "marc-dump!" => \$marc_dump,
115  );  );
116    
117  $config = LoadFile($config);  $config = LoadFile($config);
# Line 294  while (my ($database, $db_config) = each Line 300  while (my ($database, $db_config) = each
300                                          $log->error( "MFN $mfn validation errors:\n", join("\n", @errors) ) if (@errors);                                          $log->error( "MFN $mfn validation errors:\n", join("\n", @errors) ) if (@errors);
301                                  }                                  }
302    
                                           
303                                  my $ds = WebPAC::Normalize::data_structure(                                  my $ds = WebPAC::Normalize::data_structure(
304                                          row => $row,                                          row => $row,
305                                          rules => $rules,                                          rules => $rules,
# Line 322  while (my ($database, $db_config) = each Line 327  while (my ($database, $db_config) = each
327                                                  $log->warn("MARC record $mfn is empty, skipping");                                                  $log->warn("MARC record $mfn is empty, skipping");
328                                          } else {                                          } else {
329                                                  $marc->add_fields( @marc_fields );                                                  $marc->add_fields( @marc_fields );
330    
331                                                    # tweak leader
332                                                    if (my $new_l = WebPAC::Normalize::marc_leader()) {
333    
334                                                            my $leader = $marc->leader;
335    
336                                                            foreach my $o ( keys %$new_l ) {
337                                                                    my $insert = $new_l->{$o};
338                                                                    $leader = substr($leader, 0, $o) .
339                                                                            $insert . substr($leader, $o+length($insert));
340                                                            }
341                                                            $marc->leader( $leader );
342                                                    }
343    
344                                                  if ($marc_lint) {                                                  if ($marc_lint) {
345                                                          $lint->check_record( $marc );                                                          $lint->check_record( $marc );
346                                                          my $err = join( "\n", $lint->warnings );                                                          my $err = join( "\n", $lint->warnings );
347                                                          $log->error("MARC lint detected warning on MFN $mfn\n",                                                          $log->error("MARC lint detected warning on MFN $mfn\n",
348                                                                  "Original imput row: ",dump($row), "\n",                                                                  "<<<<< Original imput row:\n",dump($row), "\n",
349                                                                  "Normalized MARC row: ",dump(@marc_fields), "\n",                                                                  ">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump(@marc_fields), "\n",
350                                                                  "MARC lint warnings: ",$err,"\n"                                                                  "!!!!! MARC lint warnings:\n",$err,"\n"
351                                                          ) if ($err);                                                          ) if ($err);
352                                                  }                                                  }
353    
354                                                    if ($marc_dump) {
355                                                            $log->info("MARC record on MFN $mfn\n",
356                                                                    "<<<<< Original imput row:\n",dump($row), "\n",
357                                                                    ">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump(@marc_fields), "\n",
358                                                            );
359                                                    }
360    
361                                                  print $marc_fh $marc->as_usmarc;                                                  print $marc_fh $marc->as_usmarc;
362                                          }                                          }
363                                  }                                  }

Legend:
Removed from v.558  
changed lines
  Added in v.576

  ViewVC Help
Powered by ViewVC 1.1.26