line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListSets; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
83
|
use strict; |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
509
|
|
4
|
16
|
|
|
16
|
|
76
|
use base qw( XML::SAX::Base Net::OAI::Base ); |
|
16
|
|
|
|
|
31
|
|
|
16
|
|
|
|
|
8393
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Net::OAI::ListSets - The results of the ListSets OAI-PMH verb. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 new() |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
1
|
8
|
my ( $class, %opts ) = @_; |
22
|
1
|
|
33
|
|
|
17
|
my $self = bless \%opts, ref( $class ) || $class; |
23
|
1
|
|
|
|
|
24
|
$self->{ specs } = {}; |
24
|
1
|
|
|
|
|
6
|
return( $self ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 setSpecs() |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Get back a list of set specification codes. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub setSpecs { |
34
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
35
|
1
|
|
|
|
|
2
|
return( sort( keys( %{ $self->{ specs } } ) ) ); |
|
1
|
|
|
|
|
55
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 setName() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Pass in a setSpec code, and get back it's name...or undef if the set spec does |
41
|
|
|
|
|
|
|
not exist for this repository. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub setName { |
46
|
112
|
|
|
112
|
1
|
22264
|
my ( $self, $setSpec ) = @_; |
47
|
112
|
50
|
|
|
|
372
|
if ( exists( $self->{ specs }{ $setSpec } ) ) { |
48
|
112
|
|
|
|
|
520
|
return( $self->{ specs }{ $setSpec } ); |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
0
|
return( undef ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
## SAX Handlers |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub start_element { |
56
|
1787
|
|
|
1787
|
1
|
10203
|
my ( $self, $element ) = @_; |
57
|
1787
|
|
|
|
|
4270
|
$self->SUPER::start_element( $element ); |
58
|
1787
|
100
|
|
|
|
16252
|
return unless $element->{ NamespaceURI } eq Net::OAI::Harvester::XMLNS_OAI; |
59
|
226
|
|
|
|
|
252
|
push( @{ $self->{ tagStack } }, $element->{ LocalName } ); |
|
226
|
|
|
|
|
1084
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub end_element { |
63
|
1787
|
|
|
1787
|
1
|
10180
|
my ( $self, $element ) = @_; |
64
|
1787
|
|
|
|
|
4168
|
$self->SUPER::end_element( $element ); |
65
|
1787
|
100
|
|
|
|
16001
|
return unless $element->{ NamespaceURI } eq Net::OAI::Harvester::XMLNS_OAI; |
66
|
226
|
|
|
|
|
239
|
pop( @{ $self->{ tagStack } } ); |
|
226
|
|
|
|
|
437
|
|
67
|
226
|
100
|
|
|
|
1096
|
if ( $element->{ LocalName } eq 'set' ) { |
68
|
56
|
|
|
|
|
222
|
$self->{ specs }{ $self->{ setSpec } } = $self->{ setName }; |
69
|
56
|
|
|
|
|
303
|
$self->{ setSpec } = $self->{ setName } = undef; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub characters { |
74
|
3761
|
|
|
3761
|
1
|
21541
|
my ( $self, $characters ) = @_; |
75
|
3761
|
|
|
|
|
4566
|
my $insideTag = @{ $self->{ tagStack } }[-1]; |
|
3761
|
|
|
|
|
8009
|
|
76
|
3761
|
100
|
|
|
|
12438
|
if ( $insideTag =~ /^(setName|setSpec)$/ ) { |
77
|
117
|
|
|
|
|
394
|
$self->{ $insideTag } .= $characters->{ Data }; |
78
|
|
|
|
|
|
|
} |
79
|
3761
|
|
|
|
|
9402
|
$self->SUPER::characters( $characters ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |