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