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.44'; |
4
|
2
|
|
|
2
|
|
1991
|
use Moose; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
16
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13225
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
155
|
|
7
|
2
|
|
|
2
|
|
14
|
use MARC::Moose::Record; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
53
|
|
8
|
2
|
|
|
2
|
|
13
|
use MARC::Moose::Parser::Marcxml; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
645
|
|
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
|
16
|
my $self = shift; |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
|
|
206
|
$self->count($self->count + 1); |
21
|
|
|
|
|
|
|
|
22
|
5
|
|
|
|
|
156
|
my $fh = $self->{fh}; |
23
|
|
|
|
|
|
|
|
24
|
5
|
50
|
|
|
|
558
|
return if eof($fh); |
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
|
|
34
|
local $/ = "</record>"; # End of record |
27
|
5
|
|
|
|
|
207
|
my $raw = <$fh>; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Skip <collection if present |
30
|
5
|
|
|
|
|
48
|
$raw =~ s/<(\/*)collection.*>//; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# End of file |
33
|
5
|
100
|
|
|
|
41
|
return unless $raw =~ /<record.*>/; |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
170
|
$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.44 |
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) 2021 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 |