line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Importer::PICA; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
1178825
|
use Catmandu::Sane; |
|
4
|
|
|
|
|
115285
|
|
|
4
|
|
|
|
|
31
|
|
6
|
4
|
|
|
4
|
|
503938
|
use PICA::Parser::XML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use PICA::Parser::Plus; |
8
|
|
|
|
|
|
|
use PICA::Parser::Plain; |
9
|
|
|
|
|
|
|
use Moo; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Importer'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has type => ( is => 'ro', default => sub { 'xml' } ); |
14
|
|
|
|
|
|
|
has parser => ( is => 'lazy' ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _build_parser { |
17
|
|
|
|
|
|
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $type = lc $self->type; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
if ( $type =~ /^(pica)?plus$/ ) { |
22
|
|
|
|
|
|
|
PICA::Parser::Plus->new( $self->fh ); |
23
|
|
|
|
|
|
|
} elsif ( $type eq 'plain') { |
24
|
|
|
|
|
|
|
PICA::Parser::Plain->new( $self->fh ); |
25
|
|
|
|
|
|
|
} elsif ( $type eq 'xml') { |
26
|
|
|
|
|
|
|
PICA::Parser::XML->new( $self->fh ); |
27
|
|
|
|
|
|
|
} else { |
28
|
|
|
|
|
|
|
die "unknown type: $type"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub generator { |
33
|
|
|
|
|
|
|
my ($self) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub { |
36
|
|
|
|
|
|
|
return $self->parser->next(); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |