line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Importer::SRU::Parser; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
27
|
use Moo; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
37
|
|
4
|
5
|
|
|
5
|
|
4341
|
use XML::LibXML::Simple qw(XMLin); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub parse { |
7
|
|
|
|
|
|
|
my ($self,$record) = @_; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
return unless defined $record; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# By default we use XML::LibXML::Simple to keep backwards compatible... |
12
|
|
|
|
|
|
|
my $xs = XML::LibXML::Simple->new(); |
13
|
|
|
|
|
|
|
$record->{recordData} = $xs->XMLin($record->{recordData} , KeepRoot => 1, NsStrip => 1); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$record; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Catmandu::Importer::SRU::Parser - Package transforms SRU responses into Perl |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
package MyParser; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use Moo; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub parse { |
29
|
|
|
|
|
|
|
my ($self,$record) = @_; |
30
|
|
|
|
|
|
|
my $schema = $record->{recordSchema}; |
31
|
|
|
|
|
|
|
my $packing = $record->{recordPacking}; |
32
|
|
|
|
|
|
|
my $data = $record->{recordData}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
... do some magic... |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $perl_hash; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Catmandu::Importer::SRU can optionally include a parser to transform the |
42
|
|
|
|
|
|
|
returned records from SRU requests. Any such parser needs to implement one |
43
|
|
|
|
|
|
|
instance method 'parse' which receives an SRU-record and returns a perl hash; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Patrick Hochstenbach, C<< <patrick.hochstenbach at ugent.be> >> |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |