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.46'; |
4
|
2
|
|
|
2
|
|
1650
|
use Moose; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
15
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13606
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
165
|
|
7
|
2
|
|
|
2
|
|
15
|
use MARC::Moose::Record; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
8
|
2
|
|
|
2
|
|
15
|
use MARC::Moose::Parser::Iso2709; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
674
|
|
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
|
|
|
|
|
46
|
my @records = split /\x1d/, $self->string; |
27
|
1
|
|
|
|
|
42
|
$self->records( \@records ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Pop last entry which empty |
30
|
1
|
50
|
|
|
|
4
|
if ( @records ) { pop @records }; |
|
1
|
|
|
|
|
30
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub read { |
36
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
71
|
my $count = $self->count; |
39
|
2
|
100
|
|
|
|
19
|
return if $count == @{ $self->records }; |
|
2
|
|
|
|
|
62
|
|
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
32
|
my $raw = $self->records->[$count]; |
42
|
|
|
|
|
|
|
# remove illegal garbage that sometimes occurs between records |
43
|
1
|
|
|
|
|
10
|
$raw =~ s/^[ \x00\x0a\x0d\x1a]+//; |
44
|
1
|
|
|
|
|
33
|
my $record = $self->parser->parse( $raw ); |
45
|
1
|
|
|
|
|
4
|
$count++; |
46
|
1
|
|
|
|
|
30
|
$self->count( $count ); |
47
|
1
|
|
|
|
|
28
|
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.46 |
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) 2022 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 |