| 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.46'; | |||||||||
| 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 | default => sub { | ||||||||||
| 14 | 1 | ▶ | my $parser = MARC::Moose::Parser::Iso2709->new(); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | return $parser; | |||||||||
| 16 | } | ||||||||||
| 17 | 2 | ); | |||||||||
| 18 | |||||||||||
| 19 | |||||||||||
| 20 | sub read { | ||||||||||
| 21 | 3 | ▶ | my $self = shift; | ||||||||
|
Subroutine
read: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 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__ | ||||||||||
| 44 | |||||||||||
| 45 | =pod | ||||||||||
| 46 | |||||||||||
| 47 | =encoding UTF-8 | ||||||||||
| 48 | |||||||||||
| 49 | =head1 NAME | ||||||||||
| 50 | |||||||||||
| 51 | MARC::Moose::Reader::File::Iso2709 - File reader for MARC::Moose record from ISO2709 file | ||||||||||
| 52 | |||||||||||
| 53 | =head1 VERSION | ||||||||||
| 54 | |||||||||||
| 55 | version 1.0.46 | ||||||||||
| 56 | |||||||||||
| 57 | =head1 AUTHOR | ||||||||||
| 58 | |||||||||||
| 59 | Frédéric Demians <f.demians@tamil.fr> | ||||||||||
| 60 | |||||||||||
| 61 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 62 | |||||||||||
| 63 | This software is copyright (c) 2022 by Frédéric Demians. | ||||||||||
| 64 | |||||||||||
| 65 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 66 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 67 | |||||||||||
| 68 | =cut | ||||||||||