| 1 | package MARC::Moose::Reader::File::Isis; | ||
| 2 | # ABSTRACT: A file reader for ISIS (DOS) encoded records | ||
| 3 | $MARC::Moose::Reader::File::Isis::VERSION = '1.0.46'; | ||
| 4 | use Moose; | ||
| 5 | |||
| 6 | use Carp; | ||
| 7 | use MARC::Moose::Record; | ||
| 8 | use MARC::Moose::Parser::Isis; | ||
| 9 | |||
| 10 | with 'MARC::Moose::Reader::File'; | ||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | has '+parser' => ( default => sub { MARC::Moose::Parser::Isis->new() } ); | ||
| 15 | |||
| 16 | |||
| 17 | sub read { | ||
| 18 | my $self = shift; | ||
| 19 | |||
| 20 | $self->count( $self->count + 1 ); | ||
| 21 | |||
| 22 | my $fh = $self->fh; | ||
| 23 | my $raw; | ||
| 24 | while ( <$fh> ) { | ||
| 25 | s/\x0a|\x0d//g; | ||
| 26 | $raw .= $_; | ||
| 27 | last if /\x1d/; # End of record separator | ||
| 28 | } | ||
| 29 | return 0 unless $raw; | ||
| 30 | |||
| 31 | return $self->parser->parse( $raw ); | ||
| 32 | } | ||
| 33 | |||
| 34 | __PACKAGE__->meta->make_immutable; | ||
| 35 | |||
| 36 | 1; | ||
| 37 | |||
| 38 | __END__ | ||
| 39 | |||
| 40 | =pod | ||
| 41 | |||
| 42 | =encoding UTF-8 | ||
| 43 | |||
| 44 | =head1 NAME | ||
| 45 | |||
| 46 | MARC::Moose::Reader::File::Isis - A file reader for ISIS (DOS) encoded records | ||
| 47 | |||
| 48 | =head1 VERSION | ||
| 49 | |||
| 50 | version 1.0.46 | ||
| 51 | |||
| 52 | =head1 DESCRIPTION | ||
| 53 | |||
| 54 | Read next available L<MARC::Moose::Record> from reader file using | ||
| 55 | L<MARC::Moose::Parser::Isis> parser. | ||
| 56 | |||
| 57 | =head1 ATTRIBUTES | ||
| 58 | |||
| 59 | =head2 parser | ||
| 60 | |||
| 61 | By default, use L<MARC::Moose::Parser::Isis> to read L<MARC::Moose::Record> | ||
| 62 | records from a file. | ||
| 63 | |||
| 64 | has '+parser' => ( default => sub { MARC::Moose::Parser::Isis->new() } ); | ||
| 65 | |||
| 66 | =head1 SEE ALSO | ||
| 67 | |||
| 68 | =over 4 | ||
| 69 | |||
| 70 | =item * | ||
| 71 | |||
| 72 | L<MARC::Moose> | ||
| 73 | |||
| 74 | =item * | ||
| 75 | |||
| 76 | L<MARC::Moose::Reader::File> | ||
| 77 | |||
| 78 | =item * | ||
| 79 | |||
| 80 | L<MARC::Moose::Parser::Isis> | ||
| 81 | |||
| 82 | =back | ||
| 83 | |||
| 84 | =head1 AUTHOR | ||
| 85 | |||
| 86 | Frédéric Demians <f.demians@tamil.fr> | ||
| 87 | |||
| 88 | =head1 COPYRIGHT AND LICENSE | ||
| 89 | |||
| 90 | This software is copyright (c) 2022 by Frédéric Demians. | ||
| 91 | |||
| 92 | This is free software; you can redistribute it and/or modify it under | ||
| 93 | the same terms as the Perl 5 programming language system itself. | ||
| 94 | |||
| 95 | =cut |