line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::Identify; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
87
|
use strict; |
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
430
|
|
4
|
17
|
|
|
17
|
|
525
|
use warnings; |
|
17
|
|
|
|
|
35
|
|
|
17
|
|
|
|
|
550
|
|
5
|
17
|
|
|
17
|
|
80
|
use base qw( XML::SAX::Base Net::OAI::Base ); |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
10702
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Net::OAI::Identify - Results of the Identify 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
|
6
|
|
|
6
|
1
|
29
|
my ( $class, %opts ) = @_; |
23
|
6
|
|
33
|
|
|
46
|
my $self = bless \%opts, ref( $class ) || $class; |
24
|
6
|
|
|
|
|
47
|
$self->{ repositoryName } = ''; |
25
|
6
|
|
|
|
|
24
|
$self->{ baseUrl } = ''; |
26
|
6
|
|
|
|
|
23
|
$self->{ protocolVersion } = ''; |
27
|
6
|
|
|
|
|
23
|
$self->{ earliestDatestamp } = ''; |
28
|
6
|
|
|
|
|
18
|
$self->{ deletedRecord } = ''; |
29
|
6
|
|
|
|
|
19
|
$self->{ granularity } = ''; |
30
|
6
|
|
|
|
|
27
|
$self->{ adminEmail } = ''; |
31
|
6
|
|
|
|
|
22
|
$self->{ adminEmails } = []; |
32
|
6
|
|
|
|
|
24
|
$self->{ compression } = ''; |
33
|
6
|
|
|
|
|
19
|
$self->{ compressions } = []; |
34
|
6
|
|
|
|
|
18
|
$self->{ _insideDescription } = 0; |
35
|
6
|
|
|
|
|
32
|
return( $self ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 repositoryName() |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Returns the name of the repostiory. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub repositoryName { |
45
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
46
|
1
|
|
|
|
|
9
|
return( $self->{ repositoryName } ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 baseURL() |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Returns the base URL used by the repository. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub baseURL { |
56
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
57
|
0
|
|
|
|
|
0
|
return( $self->{ baseURL } ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 protocolVersion() |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Returns the version of the OAI-PMH used by the repository. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub protocolVersion { |
67
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
68
|
1
|
|
|
|
|
8
|
return( $self->{ protocolVersion } ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 earliestDatestamp() |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Returns the earlies datestamp for records available in the repository. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=cut |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub earliestDatestamp { |
78
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
79
|
1
|
|
|
|
|
8
|
return( $self->{ earliestDatestamp } ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 deletedRecord() |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Indicates the way the repository works with deleted records. Should |
85
|
|
|
|
|
|
|
return I, I or I. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub deletedRecord { |
90
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
91
|
1
|
|
|
|
|
7
|
return( $self->{ deletedRecord } ); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 granularity() |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns the granularity used by the repository. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub granularity { |
101
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
102
|
1
|
|
|
|
|
7
|
return( $self->{ granularity } ); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 adminEmail() |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Returns the administrative email address for the repository. Since the |
108
|
|
|
|
|
|
|
adminEmail elelemnt is allowed to repeat you will get all the emails (if more |
109
|
|
|
|
|
|
|
than one are specified) by using adminEmail in a list context. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
$email = $identity->adminEmail(); |
112
|
|
|
|
|
|
|
@emails = $identity->adminEmails(); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub adminEmail { |
117
|
2
|
|
|
2
|
1
|
7
|
my $self = shift; |
118
|
2
|
100
|
|
|
|
7
|
if ( wantarray() ) { return( @{ $self->{ adminEmails } } ); } |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
119
|
1
|
|
|
|
|
4
|
return( $self->{ adminEmails }[ 0 ] ); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 compression() |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Returns the types of compression that the archive supports. Since the |
125
|
|
|
|
|
|
|
compression element may repeat you may get all the values by using |
126
|
|
|
|
|
|
|
compression() in a list context. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
$compression = $identity->compression(); |
129
|
|
|
|
|
|
|
@compressions = $identity->compressions(); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub compression { |
134
|
2
|
|
|
2
|
1
|
1007
|
my $self = shift; |
135
|
2
|
100
|
|
|
|
7
|
if ( wantarray() ) { return( @{ $self->{ compressions } } ); } |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
136
|
1
|
|
|
|
|
4
|
return( $self->{ compressions }[ 0 ] ); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 TODO |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Support for the various C containers. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
## SAX Handlers |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub start_element { |
148
|
33
|
|
|
33
|
1
|
212
|
my ( $self, $element ) = @_; |
149
|
33
|
100
|
|
|
|
187
|
return $self->SUPER::start_element($element) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; # should be error? |
150
|
|
|
|
|
|
|
|
151
|
14
|
|
|
|
|
18
|
push( @{ $self->{ tagStack } }, $element->{ LocalName } ); |
|
14
|
|
|
|
|
39
|
|
152
|
14
|
100
|
|
|
|
69
|
$self->{ _insideDescription } = 1 if $element->{ LocalName } eq 'description'; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub end_element { |
156
|
33
|
|
|
33
|
1
|
205
|
my ( $self, $element ) = @_; |
157
|
33
|
100
|
|
|
|
121
|
return $self->SUPER::end_element($element) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; # should be error? |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
## store and reset elements that can have multiple values |
160
|
14
|
100
|
|
|
|
44
|
if ( $element->{ LocalName } eq 'adminEmail' ) { |
|
|
50
|
|
|
|
|
|
161
|
3
|
|
|
|
|
10
|
Net::OAI::Harvester::debug( "got adminEmail in Identify" ); |
162
|
3
|
|
|
|
|
4
|
push( @{ $self->{ adminEmails } }, $self->{ adminEmail } ); |
|
3
|
|
|
|
|
9
|
|
163
|
3
|
|
|
|
|
8
|
$self->{ adminEmail } = ''; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
elsif ( $element->{ LocalName } eq 'compression' ) { |
166
|
0
|
|
|
|
|
0
|
Net::OAI::Harvester::debug( "got compression in Identify" ); |
167
|
0
|
|
|
|
|
0
|
push( @{ $self->{ compressions } }, $self->{ compression } ); |
|
0
|
|
|
|
|
0
|
|
168
|
0
|
|
|
|
|
0
|
$self->{ compression } = ''; |
169
|
|
|
|
|
|
|
} |
170
|
14
|
|
|
|
|
18
|
pop( @{ $self->{ tagStack } } ); |
|
14
|
|
|
|
|
26
|
|
171
|
14
|
100
|
|
|
|
65
|
$self->{ _insideDescription } = 0 if $element->{ LocalName } eq 'description'; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub characters { |
175
|
71
|
|
|
71
|
1
|
425
|
my ( $self, $characters ) = @_; |
176
|
|
|
|
|
|
|
|
177
|
71
|
100
|
|
|
|
138
|
if ( $self->{ _insideDescription } ) { |
178
|
39
|
|
|
|
|
117
|
return $self->SUPER::characters( $characters ); |
179
|
|
|
|
|
|
|
} else { |
180
|
|
|
|
|
|
|
$self->{ $self->{ tagStack }[-1] } .= $characters->{ Data } |
181
|
32
|
|
|
|
|
165
|
} |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
1; |
185
|
|
|
|
|
|
|
|