line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Catmandu::FedoraCommons::Model::pidList - Perl model for the Fedora 'getNextPID' REST call |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Catmandu::FedoraCommons; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $fedora = Catmandu::FedoraCommons->new('http://localhost:8080/fedora','fedoraAdmin','fedoraAdmin'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $obj = $fedora->getNextPID()->parse_content; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
[ |
14
|
|
|
|
|
|
|
'changeme:102' |
15
|
|
|
|
|
|
|
] |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SEE ALSO |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
L<Catmandu::FedoraCommons> |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
package Catmandu::FedoraCommons::Model::pidList; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
48053
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub parse { |
28
|
|
|
|
|
|
|
my ($class,$xml) = @_; |
29
|
|
|
|
|
|
|
my $dom = XML::LibXML->load_xml(string => $xml); |
30
|
|
|
|
|
|
|
$dom->getDocumentElement()->setNamespace('http://www.fedora.info/definitions/1/0/management/','m'); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my @nodes = $dom->findnodes("/m:pidList/m:pid"); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $result; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
foreach my $node (@nodes) { |
37
|
|
|
|
|
|
|
my $value = $node->textContent; |
38
|
|
|
|
|
|
|
push @$result , $value; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $result; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |