5 |
|
|
6 |
use base qw/WebPAC::Common/; |
use base qw/WebPAC::Common/; |
7 |
|
|
8 |
use MARC::Record 2.0; # need 2.0 for utf-8 encoding see marcpm.sf.net |
use MARC::Record; |
9 |
use MARC::Lint; |
use MARC::Lint; |
10 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
11 |
use Encode qw/from_to decode/; |
use Encode qw/from_to decode/; |
16 |
|
|
17 |
=head1 VERSION |
=head1 VERSION |
18 |
|
|
19 |
Version 0.03 |
Version 0.04 |
20 |
|
|
21 |
=cut |
=cut |
22 |
|
|
23 |
our $VERSION = '0.03'; |
our $VERSION = '0.04'; |
24 |
|
|
25 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
26 |
|
|
75 |
$marc->add( |
$marc->add( |
76 |
id => $mfn, |
id => $mfn, |
77 |
fields => WebPAC::Normalize::_get_marc_fields(), |
fields => WebPAC::Normalize::_get_marc_fields(), |
78 |
leader => WebPAC::Normalize::marc_leader(), |
leader => WebPAC::Normalize::_get_marc_leader(), |
79 |
row => $row, |
row => $row, |
80 |
); |
); |
81 |
|
|
114 |
} |
} |
115 |
} |
} |
116 |
|
|
117 |
|
# sort fields |
118 |
|
@$fields = sort { $a->[0] <=> $b->[0] } @$fields; |
119 |
|
|
120 |
$log->debug("recode fields = ", sub { dump( $fields ) }); |
$log->debug("recode fields = ", sub { dump( $fields ) }); |
121 |
|
|
122 |
$marc->add_fields( @$fields ); |
$marc->add_fields( @$fields ); |
140 |
if (@w) { |
if (@w) { |
141 |
$log->error("MARC lint detected warning on record $id\n", |
$log->error("MARC lint detected warning on record $id\n", |
142 |
"<<<<< Original input row:\n",dump($arg->{row}), "\n", |
"<<<<< Original input row:\n",dump($arg->{row}), "\n", |
143 |
">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump( $arg->{fields} ), "\n", |
">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump( $fields ), "\n", |
144 |
"!!!!! MARC lint warnings:\n",join("\n",@w),"\n" |
"!!!!! MARC lint warnings:\n",join("\n",@w),"\n" |
145 |
); |
); |
146 |
map { $self->{_marc_lint_warnings}->{$_}++ } @w; |
map { $self->{_marc_lint_warnings}->{$_}++ } @w; |
150 |
if ($self->{dump}) { |
if ($self->{dump}) { |
151 |
$log->info("MARC record on record $id\n", |
$log->info("MARC record on record $id\n", |
152 |
"<<<<< Original imput row:\n",dump($arg->{row}), "\n", |
"<<<<< Original imput row:\n",dump($arg->{row}), "\n", |
153 |
">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump( $arg->{fields} ), "\n", |
">>>>> Normalized MARC row: leader: [", $marc->leader(), "]\n", dump( $fields ), "\n", |
154 |
); |
); |
155 |
} |
} |
156 |
|
|