line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListSets; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
175
|
use strict; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
519
|
|
4
|
14
|
|
|
14
|
|
83
|
use base qw( XML::SAX::Base ); |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
1066
|
|
5
|
14
|
|
|
14
|
|
119
|
use base qw( Net::OAI::Base ); |
|
14
|
|
|
|
|
37
|
|
|
14
|
|
|
|
|
7143
|
|
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
|
6
|
my ( $class, %opts ) = @_; |
23
|
1
|
|
33
|
|
|
10
|
my $self = bless \%opts, ref( $class ) || $class; |
24
|
1
|
|
|
|
|
14
|
$self->{ insideSet } = 0; |
25
|
1
|
|
|
|
|
4
|
$self->{ specs } = {}; |
26
|
1
|
|
|
|
|
5
|
return( $self ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 setSpecs() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Get back a list of set specification codes. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub setSpecs { |
36
|
1
|
|
|
1
|
1
|
855
|
my $self = shift; |
37
|
1
|
|
|
|
|
2
|
return( sort( keys( %{ $self->{ specs } } ) ) ); |
|
1
|
|
|
|
|
50
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 setName() |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Pass in a setSpec code, and get back it's name...or undef if the set spec does |
43
|
|
|
|
|
|
|
not exist for this repository. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub setName { |
48
|
112
|
|
|
112
|
1
|
32834
|
my ( $self, $setSpec ) = @_; |
49
|
112
|
50
|
|
|
|
382
|
if ( exists( $self->{ specs }{ $setSpec } ) ) { |
50
|
112
|
|
|
|
|
570
|
return( $self->{ specs }{ $setSpec } ); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
0
|
return( undef ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
## SAX Handlers |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub start_element { |
58
|
1789
|
|
|
1789
|
1
|
11224
|
my ( $self, $element ) = @_; |
59
|
1789
|
|
|
|
|
4746
|
$self->SUPER::start_element( $element ); |
60
|
1789
|
|
|
|
|
9644
|
push( @{ $self->{ tagStack } }, $element->{ Name } ); |
|
1789
|
|
|
|
|
8886
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub end_element { |
64
|
1789
|
|
|
1789
|
1
|
11089
|
my ( $self, $element ) = @_; |
65
|
1789
|
100
|
|
|
|
4597
|
if ( $element->{ Name } eq 'set' ) { |
66
|
56
|
|
|
|
|
360
|
$self->{ specs }{ $self->{ setSpec } } = $self->{ setName }; |
67
|
56
|
|
|
|
|
157
|
$self->{ setSpec } = undef; |
68
|
56
|
|
|
|
|
128
|
$self->{ setName } = undef; |
69
|
|
|
|
|
|
|
} |
70
|
1789
|
|
|
|
|
4986
|
$self->SUPER::end_element( $element ); |
71
|
1789
|
|
|
|
|
15863
|
pop( @{ $self->{ tagStack } } ); |
|
1789
|
|
|
|
|
7587
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub characters { |
75
|
3763
|
|
|
3763
|
1
|
21681
|
my ( $self, $characters ) = @_; |
76
|
3763
|
|
|
|
|
3938
|
my $insideTag = @{ $self->{ tagStack } }[-1]; |
|
3763
|
|
|
|
|
7286
|
|
77
|
3763
|
100
|
|
|
|
10722
|
if ( $insideTag =~ /^(setName|setSpec)$/ ) { |
78
|
117
|
|
|
|
|
397
|
$self->{ $insideTag } .= $characters->{ Data }; |
79
|
|
|
|
|
|
|
} |
80
|
3763
|
|
|
|
|
9902
|
$self->SUPER::characters( $characters ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |