line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MARC::Moose::Reader::String::Iso2709; |
2
|
|
|
|
|
|
|
# ABSTRACT: File reader for MARC::Moose record from ISO2709 string |
3
|
|
|
|
|
|
|
$MARC::Moose::Reader::String::Iso2709::VERSION = '1.0.44'; |
4
|
2
|
|
|
2
|
|
1756
|
use Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13139
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
168
|
|
7
|
2
|
|
|
2
|
|
16
|
use MARC::Moose::Record; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
55
|
|
8
|
2
|
|
|
2
|
|
13
|
use MARC::Moose::Parser::Iso2709; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1064
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'MARC::Moose::Reader::String'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has parser => ( |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
isa => 'MARC::Moose::Parser', |
16
|
|
|
|
|
|
|
default => sub { MARC::Moose::Parser::Iso2709->new() }, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# An arrayref of all ISO2709 MARC record found in the string |
20
|
|
|
|
|
|
|
has records => ( is => 'rw', isa => 'ArrayRef' ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub BUILD { |
24
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
41
|
my @records = split /\x1d/, $self->string; |
27
|
1
|
|
|
|
|
49
|
$self->records( \@records ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Pop last entry which empty |
30
|
1
|
50
|
|
|
|
4
|
if ( @records ) { pop @records }; |
|
1
|
|
|
|
|
39
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub read { |
36
|
2
|
|
|
2
|
0
|
7
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
72
|
my $count = $self->count; |
39
|
2
|
100
|
|
|
|
20
|
return if $count == @{ $self->records }; |
|
2
|
|
|
|
|
65
|
|
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
31
|
my $raw = $self->records->[$count]; |
42
|
|
|
|
|
|
|
# remove illegal garbage that sometimes occurs between records |
43
|
1
|
|
|
|
|
9
|
$raw =~ s/^[ \x00\x0a\x0d\x1a]+//; |
44
|
1
|
|
|
|
|
32
|
my $record = $self->parser->parse( $raw ); |
45
|
1
|
|
|
|
|
5
|
$count++; |
46
|
1
|
|
|
|
|
35
|
$self->count( $count ); |
47
|
1
|
|
|
|
|
32
|
return $record; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=encoding UTF-8 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
MARC::Moose::Reader::String::Iso2709 - File reader for MARC::Moose record from ISO2709 string |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
version 1.0.44 |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHOR |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Frédéric Demians <f.demians@tamil.fr> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Frédéric Demians. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
77
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |