2 |
|
|
3 |
use strict; |
use strict; |
4 |
use Carp; |
use Carp; |
5 |
use Data::Dumper; |
use Data::Dump qw/dump/; |
6 |
|
|
7 |
BEGIN { |
BEGIN { |
8 |
use Exporter (); |
use Exporter (); |
124 |
|
|
125 |
# skip to next record |
# skip to next record |
126 |
my $o = substr($leader,0,5); |
my $o = substr($leader,0,5); |
127 |
|
warn "# in record ", $self->{count}," record length isn't number but: ",dump($o),"\n" unless $o =~ m/^\d+$/; |
128 |
if ($o > 24) { |
if ($o > 24) { |
129 |
seek($self->{fh},$o-24,1) if ($o); |
seek($self->{fh},$o-24,1) if ($o); |
130 |
} else { |
} else { |
384 |
1; |
1; |
385 |
__END__ |
__END__ |
386 |
|
|
387 |
|
=head1 UTF-8 ENCODING |
388 |
|
|
389 |
|
This module does nothing with encoding. But, since MARC format is byte |
390 |
|
oriented even when using UTF-8 which has variable number of bytes for each |
391 |
|
character, file is opened in binary mode. |
392 |
|
|
393 |
|
As a result, all scalars recturned to perl don't have utf-8 flag. Solution is |
394 |
|
to use C<hash_filter> and L<Encode> to decode utf-8 encoding like this: |
395 |
|
|
396 |
|
use Encode; |
397 |
|
|
398 |
|
my $marc = new MARC::Fast( |
399 |
|
marcdb => 'utf8.marc', |
400 |
|
hash_filter => sub { |
401 |
|
Encode::decode( 'utf-8', $_[0] ); |
402 |
|
}, |
403 |
|
); |
404 |
|
|
405 |
|
This will affect C<to_hash>, but C<fetch> will still return binary representation |
406 |
|
since it doesn't support C<hash_filter>. |
407 |
|
|
408 |
=head1 AUTHOR |
=head1 AUTHOR |
409 |
|
|
410 |
Dobrica Pavlinusic |
Dobrica Pavlinusic |