line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListMetadataFormats; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
88
|
use strict; |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
447
|
|
4
|
17
|
|
|
17
|
|
87
|
use warnings; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
514
|
|
5
|
17
|
|
|
17
|
|
84
|
use base qw( XML::SAX::Base Net::OAI::Base ); |
|
17
|
|
|
|
|
29
|
|
|
17
|
|
|
|
|
1724
|
|
6
|
17
|
|
|
17
|
|
88
|
use Carp qw( carp ); |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
14093
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::OAI::ListMetadataFormats - Results of the ListMetadataFormats OAI-PMH verb. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 new() |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
2
|
|
|
2
|
1
|
13
|
my ( $class, %opts ) = @_; |
24
|
2
|
|
33
|
|
|
26
|
my $self = bless \%opts, ref( $class ) || $class; |
25
|
2
|
|
|
|
|
24
|
$self->{ _insideList } = 0; |
26
|
2
|
|
|
|
|
9
|
$self->{ metadataPrefixes } = []; |
27
|
2
|
|
|
|
|
11
|
$self->{ namespaces } = []; |
28
|
2
|
|
|
|
|
10
|
$self->{ schemas } = []; |
29
|
2
|
|
|
|
|
13
|
return( $self ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 prefixes() |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub prefixes() { |
37
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
38
|
1
|
|
|
|
|
2
|
return( @{ $self->{ metadataPrefixes } } ); |
|
1
|
|
|
|
|
5
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 namespaces() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub namespaces { |
46
|
1
|
|
|
1
|
1
|
1003
|
my $self = shift; |
47
|
1
|
|
|
|
|
3
|
return( @{ $self->{ namespaces } } ); |
|
1
|
|
|
|
|
6
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 namespaces_byprefix() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Returns the namespace URI associated to a given metadataPrefix. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub namespaces_byprefix { |
57
|
1
|
|
|
1
|
1
|
493
|
my ($self, $prefix) = @_; |
58
|
1
|
|
|
|
|
6
|
return $self->{namespaces_byprefix}->{$prefix}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 schemas() |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub schemas { |
67
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
68
|
1
|
|
|
|
|
3
|
return( @{ $self->{ schemas } } ); |
|
1
|
|
|
|
|
5
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 schemas_byprefix() |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Returns the schema URI associated to a given metadataPrefix. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub schemas_byprefix { |
78
|
1
|
|
|
1
|
1
|
556
|
my ($self, $prefix) = @_; |
79
|
1
|
|
|
|
|
5
|
return $self->{schemas_byprefix}->{$prefix}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# SAX Handlers |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub start_element { |
85
|
19
|
|
|
19
|
1
|
151
|
my ( $self, $element ) = @_; |
86
|
19
|
50
|
|
|
|
52
|
return $self->SUPER::start_element($element) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; # should be error? |
87
|
|
|
|
|
|
|
|
88
|
19
|
100
|
|
|
|
66
|
if ( $element->{ LocalName } eq 'ListMetadataFormats' ) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
89
|
1
|
|
|
|
|
3
|
$self->{ _insideList } = 1; |
90
|
|
|
|
|
|
|
} elsif ( $self->{ _insideList } ) { |
91
|
|
|
|
|
|
|
} elsif ( $element->{ LocalName } eq 'OAI-PMH' ) { |
92
|
|
|
|
|
|
|
} else { |
93
|
0
|
|
|
|
|
0
|
carp "who am I? (".$element->{ LocalName }.")"; |
94
|
0
|
|
|
|
|
0
|
$self->SUPER::start_element( $element ); |
95
|
|
|
|
|
|
|
} |
96
|
19
|
|
|
|
|
25
|
push( @{ $self->{ tagStack } }, $element->{ LocalName } ); |
|
19
|
|
|
|
|
88
|
|
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub end_element { |
100
|
19
|
|
|
19
|
1
|
146
|
my ( $self, $element ) = @_; |
101
|
19
|
50
|
|
|
|
48
|
return $self->SUPER::end_element($element) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; # should be error? |
102
|
|
|
|
|
|
|
|
103
|
19
|
|
|
|
|
32
|
my $name = $element->{ LocalName }; |
104
|
19
|
100
|
|
|
|
83
|
if ( $name eq 'ListMetadataFormats' ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
105
|
1
|
|
|
|
|
3
|
$self->{ _insideList } = 0; |
106
|
|
|
|
|
|
|
} elsif ( $name eq 'metadataFormat' ) { |
107
|
4
|
|
|
|
|
7
|
my $nspf = delete $self->{ _currpf }; |
108
|
4
|
|
|
|
|
14
|
$self->{ namespaces_byprefix }->{ $nspf } = delete $self->{ _currns }; |
109
|
4
|
|
|
|
|
12
|
$self->{ schemas_byprefix }->{ $nspf } = delete $self->{ _currxs }; |
110
|
|
|
|
|
|
|
} elsif ( $name eq 'metadataPrefix' ) { |
111
|
4
|
|
|
|
|
11
|
push( @{ $self->{ metadataPrefixes } }, $self->{ metadataPrefix } ); |
|
4
|
|
|
|
|
12
|
|
112
|
4
|
|
|
|
|
9
|
$self->{ _currpf } = $self->{ metadataPrefix }; |
113
|
4
|
|
|
|
|
9
|
$self->{ metadataPrefix } = ''; |
114
|
|
|
|
|
|
|
} elsif ( $name eq 'schema' ) { |
115
|
4
|
|
|
|
|
6
|
push( @{ $self->{ schemas } }, $self->{schema } ); |
|
4
|
|
|
|
|
12
|
|
116
|
4
|
|
|
|
|
11
|
$self->{ _currxs } = $self->{ schema }; |
117
|
4
|
|
|
|
|
8
|
$self->{ schema } = ''; |
118
|
|
|
|
|
|
|
} elsif ( $name eq 'metadataNamespace' ) { |
119
|
4
|
|
|
|
|
6
|
push( @{ $self->{ namespaces } }, $self->{ metadataNamespace } ); |
|
4
|
|
|
|
|
11
|
|
120
|
4
|
|
|
|
|
9
|
$self->{ _currns } = $self->{ metadataNamespace }; |
121
|
4
|
|
|
|
|
9
|
$self->{ metadataNamespace } = ''; |
122
|
|
|
|
|
|
|
} elsif ( $self->{ _insideList } ) { |
123
|
0
|
|
|
|
|
0
|
carp "who am I? ($name)"; |
124
|
|
|
|
|
|
|
} elsif ( $element->{ LocalName } eq 'OAI-PMH' ) { |
125
|
|
|
|
|
|
|
} else { |
126
|
0
|
|
|
|
|
0
|
carp "who am I? ($name)"; |
127
|
0
|
|
|
|
|
0
|
$self->SUPER::end_element( $element ); |
128
|
|
|
|
|
|
|
} |
129
|
19
|
|
|
|
|
23
|
pop( @{ $self->{ tagStack } } ); |
|
19
|
|
|
|
|
72
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub characters { |
133
|
41
|
|
|
41
|
1
|
276
|
my ( $self, $characters ) = @_; |
134
|
41
|
100
|
|
|
|
88
|
if ( $self->{ _insideList } ) { |
135
|
|
|
|
|
|
|
$self->{ $self->{ tagStack }[-1] } .= $characters->{ Data } |
136
|
33
|
|
|
|
|
172
|
} else { |
137
|
8
|
|
|
|
|
81
|
$self->SUPER::characters( $characters )}; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |