line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListIdentifiers; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
108
|
use strict; |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
461
|
|
4
|
17
|
|
|
17
|
|
85
|
use warnings; |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
496
|
|
5
|
17
|
|
|
17
|
|
86
|
use base qw( XML::SAX::Base Net::OAI::Base ); |
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
1626
|
|
6
|
17
|
|
|
17
|
|
86
|
use Carp qw ( croak ); |
|
17
|
|
|
|
|
33
|
|
|
17
|
|
|
|
|
819
|
|
7
|
17
|
|
|
17
|
|
10580
|
use Net::OAI::Record::Header; |
|
17
|
|
|
|
|
44
|
|
|
17
|
|
|
|
|
534
|
|
8
|
17
|
|
|
17
|
|
107
|
use File::Temp qw( tempfile ); |
|
17
|
|
|
|
|
30
|
|
|
17
|
|
|
|
|
901
|
|
9
|
17
|
|
|
17
|
|
12871
|
use IO::File; |
|
17
|
|
|
|
|
17312
|
|
|
17
|
|
|
|
|
3131
|
|
10
|
17
|
|
|
17
|
|
101
|
use Storable qw( store_fd fd_retrieve ); |
|
17
|
|
|
|
|
32
|
|
|
17
|
|
|
|
|
9815
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Net::OAI::ListIdentifiers - Results of the ListIdentifiers OAI-PMH verb. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 METHODS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This class is based on C and inherits the general methods |
23
|
|
|
|
|
|
|
expect for the following: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 new() |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
6
|
|
|
6
|
1
|
43
|
my ( $class, %opts ) = @_; |
31
|
6
|
|
33
|
|
|
77
|
my $self = bless \%opts, ref( $class ) || $class; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
## open a temp file for storing identifiers |
34
|
6
|
|
|
|
|
61
|
my ($fh,$filename) = tempfile(UNLINK => 1); |
35
|
6
|
|
|
|
|
5786
|
$self->{ headerFileHandle } = $fh; |
36
|
6
|
|
|
|
|
34
|
$self->{ headerFilename } = $filename; |
37
|
|
|
|
|
|
|
## so we can store code refs |
38
|
6
|
|
|
|
|
21
|
$Storable::Deparse = 1; |
39
|
6
|
|
|
|
|
17
|
$Storable::Eval = 1; |
40
|
6
|
|
|
|
|
44
|
return( $self ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 next() |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Returns the L object for the next OAI record in the |
46
|
|
|
|
|
|
|
response, C if none remain. resumptionToken handling is performed |
47
|
|
|
|
|
|
|
automagically if the original request was listAllIdentifiers(). |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub next { |
52
|
2003
|
|
|
2003
|
1
|
394508
|
my $self = shift; |
53
|
|
|
|
|
|
|
|
54
|
2003
|
100
|
|
|
|
6757
|
if ( ! $self->{ headerFileHandle } ) { |
55
|
|
|
|
|
|
|
$self->{ headerFileHandle } = IO::File->new( $self->{ headerFilename } ) |
56
|
3
|
50
|
|
|
|
28
|
or croak "unable to open temp file: ".$self->{ headerFilename }; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
2003
|
100
|
|
|
|
7511
|
if ( $self->{ headerFileHandle }->eof() ) { |
60
|
|
|
|
|
|
|
$self->{ headerFileHandle }->close() or croak "Could not close() ".$self->{ headerFilename } |
61
|
2
|
50
|
|
|
|
42
|
.". File system full?"; |
62
|
2
|
|
|
|
|
208
|
return( $self->handleResumptionToken( 'listIdentifiers' ) ); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
2001
|
|
|
|
|
17720
|
my $header = fd_retrieve( $self->{ headerFileHandle } ); |
66
|
2001
|
|
|
|
|
66475
|
return( $header ); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
## SAX Handlers |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub start_element { |
72
|
23163
|
|
|
23163
|
1
|
137197
|
my ( $self, $element ) = @_; |
73
|
23163
|
50
|
|
|
|
56170
|
return $self->SUPER::start_element( $element ) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; |
74
|
|
|
|
|
|
|
|
75
|
23163
|
100
|
|
|
|
66161
|
if ( $element->{ LocalName } eq 'header' ) { |
|
|
100
|
|
|
|
|
|
76
|
5000
|
|
|
|
|
13244
|
$self->{ OLD_Handler } = $self->get_handler(); |
77
|
5000
|
|
|
|
|
42011
|
$self->set_handler( Net::OAI::Record::Header->new() ); |
78
|
|
|
|
|
|
|
} elsif ( $element->{ LocalName } eq 'ListIdentifiers' ) { |
79
|
|
|
|
|
|
|
} |
80
|
23163
|
|
|
|
|
105274
|
$self->SUPER::start_element( $element ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub end_element { |
84
|
23163
|
|
|
23163
|
1
|
133856
|
my ( $self, $element ) = @_; |
85
|
23163
|
|
|
|
|
53843
|
$self->SUPER::end_element( $element ); |
86
|
23163
|
50
|
|
|
|
59179
|
return unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; |
87
|
|
|
|
|
|
|
|
88
|
23163
|
100
|
|
|
|
112085
|
if ( $element->{ LocalName } eq 'header' ) { |
|
|
100
|
|
|
|
|
|
89
|
5000
|
|
|
|
|
13499
|
my $header = $self->get_handler(); |
90
|
5000
|
|
|
|
|
40311
|
Net::OAI::Harvester::debug( "committing header to object store" ); |
91
|
5000
|
|
|
|
|
15269
|
store_fd( $header, $self->{ headerFileHandle } ); |
92
|
5000
|
|
|
|
|
471722
|
$self->set_handler( $self->{ OLD_Handler } ); |
93
|
|
|
|
|
|
|
} elsif ( $element->{ LocalName } eq 'ListIdentifiers' ) { |
94
|
5
|
|
|
|
|
18
|
Net::OAI::Harvester::debug( "finished reading identifiers" ); |
95
|
5
|
|
|
|
|
61
|
$self->{ headerFileHandle }->close(); |
96
|
5
|
|
|
|
|
516
|
$self->{ headerFileHandle } = undef; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|