line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MARC::Moose::Reader::File::Marcxml; |
2
|
|
|
|
|
|
|
# ABSTRACT: File reader for MARCXML file |
3
|
|
|
|
|
|
|
$MARC::Moose::Reader::File::Marcxml::VERSION = '1.0.46'; |
4
|
2
|
|
|
2
|
|
1739
|
use Moose; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13133
|
use Carp; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
128
|
|
7
|
2
|
|
|
2
|
|
14
|
use MARC::Moose::Record; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
56
|
|
8
|
2
|
|
|
2
|
|
12
|
use MARC::Moose::Parser::Marcxml; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
493
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'MARC::Moose::Reader::File'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '+parser' => ( default => sub { MARC::Moose::Parser::MarcxmlSax->new() } ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub read { |
18
|
5
|
|
|
5
|
0
|
14
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
167
|
$self->count($self->count + 1); |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
126
|
my $fh = $self->{fh}; |
23
|
|
|
|
|
|
|
|
24
|
5
|
50
|
|
|
|
929
|
return if eof($fh); |
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
27
|
local $/ = "</record>"; # End of record |
27
|
5
|
|
|
|
|
118
|
my $raw = <$fh>; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Skip <collection if present |
30
|
5
|
|
|
|
|
103
|
$raw =~ s/<(\/*)collection.*>//; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# End of file |
33
|
5
|
100
|
|
|
|
35
|
return unless $raw =~ /<record.*>/; |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
151
|
$self->parser->parse( $raw ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
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 |