| 1 | package MARC::Moose::Reader::File::Marcxml; | ||||||||||
| 2 | # ABSTRACT: File reader for MARCXML file | ||||||||||
| 3 | 2 | $MARC::Moose::Reader::File::Marcxml::VERSION = '1.0.46'; | |||||||||
| 4 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use MARC::Moose::Record; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use MARC::Moose::Parser::Marcxml; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 2 | with 'MARC::Moose::Reader::File'; | |||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | has '+parser' => ( default => sub { MARC::Moose::Parser::MarcxmlSax->new() } ); | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | sub read { | ||||||||||
| 18 | 5 | ▶ | my $self = shift; | ||||||||
|
Subroutine
read: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 19 | |||||||||||
| 20 | 5 | $self->count($self->count + 1); | |||||||||
| 21 | |||||||||||
| 22 | 5 | my $fh = $self->{fh}; | |||||||||
| 23 | |||||||||||
| 24 | 5 | ▶ | return if eof($fh); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 5 | local $/ = "</record>"; # End of record | |||||||||
| 27 | 5 | my $raw = <$fh>; | |||||||||
| 28 | |||||||||||
| 29 | # Skip <collection if present | ||||||||||
| 30 | 5 | $raw =~ s/<(\/*)collection.*>//; | |||||||||
| 31 | |||||||||||
| 32 | # End of file | ||||||||||
| 33 | 5 | ▶ | return unless $raw =~ /<record.*>/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | |||||||||||
| 35 | 4 | $self->parser->parse( $raw ); | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 39 | |||||||||||
| 40 | 2 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||
| 43 | |||||||||||
| 44 | =pod | ||||||||||
| 45 | |||||||||||
| 46 | =encoding UTF-8 | ||||||||||
| 47 | |||||||||||
| 48 | =head1 NAME | ||||||||||
| 49 | |||||||||||
| 50 | MARC::Moose::Reader::File::Marcxml - File reader for MARCXML file | ||||||||||
| 51 | |||||||||||
| 52 | =head1 VERSION | ||||||||||
| 53 | |||||||||||
| 54 | version 1.0.46 | ||||||||||
| 55 | |||||||||||
| 56 | =head1 DESCRIPTION | ||||||||||
| 57 | |||||||||||
| 58 | Override L<MARC::Moose::Reader::File>, and read a file containing MARCXML | ||||||||||
| 59 | records. | ||||||||||
| 60 | |||||||||||
| 61 | =head1 ATTRIBUTES | ||||||||||
| 62 | |||||||||||
| 63 | =head2 parser | ||||||||||
| 64 | |||||||||||
| 65 | By default, a L<MARC::Moose::Parser::MarcxmlSax> parser is used. | ||||||||||
| 66 | |||||||||||
| 67 | =head1 AUTHOR | ||||||||||
| 68 | |||||||||||
| 69 | Frédéric Demians <f.demians@tamil.fr> | ||||||||||
| 70 | |||||||||||
| 71 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 72 | |||||||||||
| 73 | This software is copyright (c) 2022 by Frédéric Demians. | ||||||||||
| 74 | |||||||||||
| 75 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 76 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 77 | |||||||||||
| 78 | =cut | ||||||||||