| 1 | package MARC::Moose::Reader::File::Iso2709; | ||||||||||
| 2 | # ABSTRACT: File reader for MARC::Moose record from ISO2709 file | ||||||||||
| 3 | 2 | $MARC::Moose::Reader::File::Iso2709::VERSION = '1.0.49'; | |||||||||
| 4 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use Modern::Perl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use MARC::Moose::Record; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use MARC::Moose::Parser::Iso2709; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | with 'MARC::Moose::Reader::File'; | |||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | has '+parser' => ( | ||||||||||
| 13 | 1 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 1 | my $parser = MARC::Moose::Parser::Iso2709->new(); | |||||||||
| 15 | 1 | return $parser; | |||||||||
| 16 | } | ||||||||||
| 17 | 2 | ); | |||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | 3 | ▶ | sub read { | ||||||||
|
Subroutine
read: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 21 | 3 | my $self = shift; | |||||||||
| 22 | |||||||||||
| 23 | 3 | $self->count( $self->count + 1); | |||||||||
| 24 | |||||||||||
| 25 | 3 | my $fh = $self->{fh}; | |||||||||
| 26 | |||||||||||
| 27 | 3 | ▶ | return if eof($fh); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 2 | local $/ = "\x1D"; # End of record | |||||||||
| 30 | 2 | my $raw = <$fh>; | |||||||||
| 31 | |||||||||||
| 32 | # remove illegal garbage that sometimes occurs between records | ||||||||||
| 33 | 2 | $raw =~ s/^[ \x00\x0a\x0d\x1a]+//; | |||||||||
| 34 | |||||||||||
| 35 | 2 | $self->parser->parse( $raw ); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 40 | |||||||||||
| 41 | 2 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||