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

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

revision 581 by dpavlin, Tue Jul 4 10:34:15 2006 UTC revision 582 by dpavlin, Tue Jul 4 11:36:21 2006 UTC
# Line 72  sub new { Line 72  sub new {
72          id => $mfn,          id => $mfn,
73          fields => WebPAC::Normalize::_get_marc_fields(),          fields => WebPAC::Normalize::_get_marc_fields(),
74          leader => WebPAC::Normalize::marc_leader(),          leader => WebPAC::Normalize::marc_leader(),
75            row => $row,
76    );    );
77    
78    C<row> is optional parametar which is used when dumping original row to
79    error log.
80    
81  =cut  =cut
82    
83  sub add {  sub add {
# Line 110  sub add { Line 114  sub add {
114    
115          if ($self->{lint}) {          if ($self->{lint}) {
116                  $self->{lint}->check_record( $marc );                  $self->{lint}->check_record( $marc );
117                  my $err = join( "\n", $self->{lint}->warnings );                  my @w = $self->{lint}->warnings;
118                  $log->error("MARC lint detected warning on record $id\n",                  if (@w) {
119                          "<<<<< Original imput row:\n",dump($arg->{row}), "\n",                          $log->error("MARC lint detected warning on record $id\n",
120                          ">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump( $arg->{fields} ), "\n",                                  "<<<<< Original imput row:\n",dump($arg->{row}), "\n",
121                          "!!!!! MARC lint warnings:\n",$err,"\n"                                  ">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump( $arg->{fields} ), "\n",
122                  ) if ($err);                                  "!!!!! MARC lint warnings:\n",join("\n",@w),"\n"
123                            );
124                            map { $self->{_marc_lint_warnings}->{$_}++ } @w;
125                    }
126          }          }
127    
128          if ($self->{dump}) {          if ($self->{dump}) {
# Line 135  Close MARC output file Line 142  Close MARC output file
142    
143    $marc->finish;    $marc->finish;
144    
145    It will also dump MARC lint warnings summary if called with C<lint>.
146    
147  =cut  =cut
148    
149  sub finish {  sub finish {
150          my $self = shift;          my $self = shift;
151    
152          close( $self->{fh} ) or $self->_get_logger->logdie("can't close ", $self->{path}, ": $!");          my $log = $self->get_logger;
153    
154            close( $self->{fh} ) or $log->logdie("can't close ", $self->{path}, ": $!");
155    
156            if (my $w = $self->{_marc_lint_warnings}) {
157                    $log->error("MARC lint warnings summary:\n",
158                            join ("\n",
159                                    map { $w->{$_} . "\t" . $_ }
160                                    sort { $w->{$b} <=> $w->{$a} } keys %$w
161                            )
162                    );
163            }
164  }  }
165    
166  =head1 AUTHOR  =head1 AUTHOR

Legend:
Removed from v.581  
changed lines
  Added in v.582

  ViewVC Help
Powered by ViewVC 1.1.26