line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListSets; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
84
|
use strict; |
|
17
|
|
|
|
|
29
|
|
|
17
|
|
|
|
|
459
|
|
4
|
17
|
|
|
17
|
|
79
|
use warnings; |
|
17
|
|
|
|
|
29
|
|
|
17
|
|
|
|
|
448
|
|
5
|
17
|
|
|
17
|
|
78
|
use base qw( XML::SAX::Base Net::OAI::Base ); |
|
17
|
|
|
|
|
68
|
|
|
17
|
|
|
|
|
8878
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::OAI::ListSets - The results of the ListSets OAI-PMH verb. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 METHODS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head2 new() |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
1
|
7
|
my ( $class, %opts ) = @_; |
23
|
1
|
|
33
|
|
|
14
|
my $self = bless \%opts, ref( $class ) || $class; |
24
|
1
|
|
|
|
|
22
|
$self->{ specs } = {}; |
25
|
1
|
|
|
|
|
7
|
return( $self ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 setSpecs() |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Get back a list of set specification codes. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub setSpecs { |
35
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
36
|
1
|
|
|
|
|
2
|
return( sort( keys( %{ $self->{ specs } } ) ) ); |
|
1
|
|
|
|
|
52
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 setName() |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Pass in a setSpec code, and get back it's name...or undef if the set spec does |
42
|
|
|
|
|
|
|
not exist for this repository. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub setName { |
47
|
112
|
|
|
112
|
1
|
28966
|
my ( $self, $setSpec ) = @_; |
48
|
112
|
50
|
|
|
|
496
|
if ( exists( $self->{ specs }{ $setSpec } ) ) { |
49
|
112
|
|
|
|
|
663
|
return( $self->{ specs }{ $setSpec } ); |
50
|
|
|
|
|
|
|
} |
51
|
0
|
|
|
|
|
0
|
return( undef ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
## SAX Handlers |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub start_element { |
57
|
1787
|
|
|
1787
|
1
|
9767
|
my ( $self, $element ) = @_; |
58
|
1787
|
|
|
|
|
3993
|
$self->SUPER::start_element( $element ); |
59
|
1787
|
100
|
|
|
|
15233
|
return unless $element->{ NamespaceURI } eq Net::OAI::Harvester::XMLNS_OAI; |
60
|
226
|
|
|
|
|
257
|
push( @{ $self->{ tagStack } }, $element->{ LocalName } ); |
|
226
|
|
|
|
|
1045
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub end_element { |
64
|
1787
|
|
|
1787
|
1
|
9875
|
my ( $self, $element ) = @_; |
65
|
1787
|
|
|
|
|
3996
|
$self->SUPER::end_element( $element ); |
66
|
1787
|
100
|
|
|
|
15103
|
return unless $element->{ NamespaceURI } eq Net::OAI::Harvester::XMLNS_OAI; |
67
|
226
|
|
|
|
|
242
|
pop( @{ $self->{ tagStack } } ); |
|
226
|
|
|
|
|
425
|
|
68
|
226
|
100
|
|
|
|
1001
|
if ( $element->{ LocalName } eq 'set' ) { |
69
|
56
|
|
|
|
|
214
|
$self->{ specs }{ $self->{ setSpec } } = $self->{ setName }; |
70
|
56
|
|
|
|
|
302
|
$self->{ setSpec } = $self->{ setName } = undef; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub characters { |
75
|
3761
|
|
|
3761
|
1
|
21031
|
my ( $self, $characters ) = @_; |
76
|
3761
|
|
|
|
|
4304
|
my $insideTag = @{ $self->{ tagStack } }[-1]; |
|
3761
|
|
|
|
|
7935
|
|
77
|
3761
|
100
|
|
|
|
11818
|
if ( $insideTag =~ /^(setName|setSpec)$/ ) { |
78
|
117
|
|
|
|
|
390
|
$self->{ $insideTag } .= $characters->{ Data }; |
79
|
|
|
|
|
|
|
} |
80
|
3761
|
|
|
|
|
9045
|
$self->SUPER::characters( $characters ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |