line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ResumptionToken; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
95
|
use strict; |
|
17
|
|
|
|
|
40
|
|
|
17
|
|
|
|
|
564
|
|
4
|
17
|
|
|
17
|
|
96
|
use warnings; |
|
17
|
|
|
|
|
40
|
|
|
17
|
|
|
|
|
603
|
|
5
|
17
|
|
|
17
|
|
95
|
use base qw( XML::SAX::Base ); |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
1305
|
|
6
|
17
|
|
|
17
|
|
90
|
use Carp qw( carp ); |
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
12910
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Net::OAI::ResumptionToken - An OAI-PMH resumption token. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
This SAX filter records resumption token elements. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 new() |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
17
|
|
|
17
|
1
|
591
|
my ( $class, %opts ) = @_; |
27
|
17
|
|
33
|
|
|
206
|
my $self = bless \%opts, ref( $class ) || $class; |
28
|
17
|
|
|
|
|
128
|
$self->{ _insideResumptionToken } = 0; |
29
|
17
|
|
|
|
|
109
|
$self->{ token } = $self->{ expirationDate } = $self->{ completeListSize } = $self->{ cursor } = undef; |
30
|
17
|
|
|
|
|
92
|
return( $self ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 token() |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
(Sets and) returns the contents of the resumptionToken element. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
All methods return C if no token was encountered. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub token { |
42
|
24
|
|
|
24
|
1
|
2644
|
my ( $self, $token ) = @_; |
43
|
24
|
50
|
|
|
|
86
|
if ( $token ) { $self->{ token } = $token; } |
|
0
|
|
|
|
|
0
|
|
44
|
24
|
|
|
|
|
172
|
return( $self->{ resumptionTokenText } ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 expirationDate() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub expirationDate { |
52
|
5
|
|
|
5
|
1
|
393
|
my ( $self, $date ) = @_; |
53
|
5
|
100
|
|
|
|
28
|
if ( $date ) { $self->{ expirationDate } = $date; } |
|
1
|
|
|
|
|
4
|
|
54
|
5
|
|
|
|
|
24
|
return( $self->{ expirationDate } ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 completeListSize() |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub completeListSize { |
62
|
5
|
|
|
5
|
1
|
1330
|
my ( $self, $size ) = @_; |
63
|
5
|
100
|
|
|
|
28
|
if ( $size ) { $self->{ completeListSize } = $size; } |
|
1
|
|
|
|
|
2
|
|
64
|
5
|
|
|
|
|
18
|
return( $self->{ completeListSize } ); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 cursor() |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub cursor { |
72
|
5
|
|
|
5
|
1
|
1259
|
my ( $self, $cursor ) = @_; |
73
|
5
|
100
|
|
|
|
22
|
if ( $cursor ) { $self->{ cursor } = $cursor; } |
|
1
|
|
|
|
|
3
|
|
74
|
5
|
|
|
|
|
17
|
return( $self->{ cursor } ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHORS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Ed Summers |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
## internal stuff |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
## all children of Net::OAI::Base should call this to make sure |
87
|
|
|
|
|
|
|
## certain object properties are set |
88
|
|
|
|
|
|
|
sub start_prefix_mapping { |
89
|
4400
|
|
|
4400
|
1
|
28658
|
my ($self, $mapping) = @_; |
90
|
4400
|
50
|
|
|
|
9730
|
die "rT: self not defined" unless defined $self; |
91
|
4400
|
50
|
|
|
|
11703
|
return $self->SUPER::start_prefix_mapping( $mapping ) if $self->get_handler(); |
92
|
0
|
|
|
|
|
0
|
die "rT: start_prefix_mapping @{[$mapping]} w/o Handler"; |
|
0
|
|
|
|
|
0
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub start_element { |
97
|
66594
|
|
|
66594
|
1
|
415809
|
my ( $self, $element ) = @_; |
98
|
66594
|
100
|
|
|
|
216950
|
return $self->SUPER::start_element( $element ) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; |
99
|
|
|
|
|
|
|
|
100
|
32217
|
100
|
|
|
|
95417
|
if ( $element->{ LocalName } eq 'resumptionToken' ) { |
|
|
50
|
|
|
|
|
|
101
|
12
|
|
|
|
|
30
|
my $attr = $element->{ Attributes }; |
102
|
12
|
50
|
|
|
|
51
|
$self->{ expirationDate } = $attr->{ '{}expirationDate' }{ Value } if $attr->{ '{}expirationDate' }; |
103
|
12
|
50
|
|
|
|
64
|
$self->{ completeListSize } = $attr->{ '{}completeListSize' }{ Value } if $attr->{ '{}completeListSize' }; |
104
|
12
|
50
|
|
|
|
61
|
$self->{ cursor } = $attr->{ '{}cursor' }{ Value } if $attr->{ '{}cursor' }; |
105
|
12
|
|
|
|
|
49
|
$self->{ resumptionTokenText } = ""; |
106
|
12
|
|
|
|
|
56
|
$self->{ _insideResumptionToken } = 1; |
107
|
|
|
|
|
|
|
} elsif ( $self->{ _insideResumptionToken } ) { |
108
|
0
|
|
|
|
|
0
|
carp "start of unhandled subelement ".$element->{ Name }." within resumptionToken"; |
109
|
|
|
|
|
|
|
} else { |
110
|
32205
|
|
|
|
|
79902
|
$self->SUPER::start_element( $element ); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub end_element { |
115
|
66594
|
|
|
66594
|
1
|
406597
|
my ( $self, $element ) = @_; |
116
|
66594
|
100
|
|
|
|
213100
|
return $self->SUPER::end_element( $element ) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; |
117
|
|
|
|
|
|
|
|
118
|
32217
|
100
|
|
|
|
91022
|
if ( $element->{ LocalName } eq 'resumptionToken' ) { |
|
|
50
|
|
|
|
|
|
119
|
12
|
|
|
|
|
50
|
Net::OAI::Harvester::debug( "caught resumption token" ); |
120
|
12
|
|
|
|
|
48
|
$self->{ _insideResumptionToken } = 0; |
121
|
|
|
|
|
|
|
} elsif ( $self->{ _insideResumptionToken } ) { |
122
|
0
|
|
|
|
|
0
|
carp "end of unhandled subelement ".$element->{ Name }." within resumptionToken"; |
123
|
|
|
|
|
|
|
} else { |
124
|
32205
|
|
|
|
|
78474
|
$self->SUPER::end_element( $element ); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub characters { |
129
|
140636
|
|
|
140636
|
1
|
839830
|
my ( $self, $characters ) = @_; |
130
|
|
|
|
|
|
|
|
131
|
140636
|
100
|
|
|
|
280635
|
if ( $self->{ _insideResumptionToken } ) { |
132
|
12
|
|
|
|
|
62
|
$self->{ resumptionTokenText } .= $characters->{ Data }; |
133
|
|
|
|
|
|
|
} else { |
134
|
140624
|
|
|
|
|
336950
|
$self->SUPER::characters( $characters ); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
1; |
139
|
|
|
|
|
|
|
|