#use base qw/WebPAC::Common/;
use Data::Dumper;
+use Encode qw/from_to/;
=head1 NAME
=head1 VERSION
-Version 0.05
+Version 0.06
=cut
-our $VERSION = '0.05';
+our $VERSION = '0.06';
=head1 SYNOPSIS
lookup => $lookup->lookup_hash,
row => $row,
rules => $normalize_pl_config,
+ marc_encoding => 'utf-8',
);
Options C<lookup>, C<row>, C<rules> and C<log> are mandatory while all
no strict 'subs';
_set_lookup( $arg->{lookup} );
_set_rec( $arg->{row} );
- _clean_ds();
-
+ _clean_ds( %{ $arg } );
eval "$arg->{rules}";
die "error evaling $arg->{rules}: $@\n" if ($@);
my $out;
my $marc21;
+my $marc_encoding;
sub _get_ds {
return $out;
=cut
sub _clean_ds {
+ my $a = {@_};
$out = undef;
$marc21 = undef;
+ $marc_encoding = $a->{marc_encoding};
}
=head2 _set_lookup
my $sf = shift or die "marc21 needs subfield";
- foreach my $v (@_) {
+ foreach (@_) {
+ my $v = $_; # make var read-write for Encode
+ next unless (defined($v) && $v !~ /^\s+$/);
+ from_to($v, 'iso-8859-2', $marc_encoding) if ($marc_encoding);
push @{ $marc21 }, [ $f, ' ', ' ', $sf => $v ];
}
}