line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListIdentifiers; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
79
|
use strict; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
514
|
|
4
|
14
|
|
|
14
|
|
70
|
use base qw( XML::SAX::Base ); |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
1051
|
|
5
|
14
|
|
|
14
|
|
72
|
use base qw( Net::OAI::Base ); |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
791
|
|
6
|
14
|
|
|
14
|
|
8332
|
use Net::OAI::Record::Header; |
|
14
|
|
|
|
|
38
|
|
|
14
|
|
|
|
|
413
|
|
7
|
14
|
|
|
14
|
|
111
|
use File::Temp qw( tempfile ); |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
900
|
|
8
|
14
|
|
|
14
|
|
13244
|
use IO::File; |
|
14
|
|
|
|
|
16285
|
|
|
14
|
|
|
|
|
2904
|
|
9
|
14
|
|
|
14
|
|
103
|
use Storable qw( store_fd fd_retrieve ); |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
8770
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Net::OAI::ListIdentifiers - Results of the ListIdentifiers OAI-PMH verb. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 new() |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new { |
26
|
7
|
|
|
7
|
1
|
46
|
my ( $class, %opts ) = @_; |
27
|
7
|
|
33
|
|
|
96
|
my $self = bless \%opts, ref( $class ) || $class; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
## open a temp file for storing identifiers |
30
|
7
|
|
|
|
|
65
|
my ($fh,$filename) = tempfile(UNLINK => 1); |
31
|
7
|
|
|
|
|
6627
|
$self->{ headerFileHandle } = $fh; |
32
|
7
|
|
|
|
|
32
|
$self->{ headerFilename } = $filename; |
33
|
|
|
|
|
|
|
## so we can store code refs |
34
|
7
|
|
|
|
|
15
|
$Storable::Deparse = 1; |
35
|
7
|
|
|
|
|
16
|
$Storable::Eval = 1; |
36
|
7
|
|
|
|
|
39
|
return( $self ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 next() |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub next { |
44
|
3793
|
|
|
3793
|
1
|
1441870
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
3793
|
100
|
|
|
|
12150
|
if ( ! $self->{ headerFileHandle } ) { |
47
|
|
|
|
|
|
|
$self->{ headerFileHandle } = |
48
|
|
|
|
|
|
|
IO::File->new( $self->{ headerFilename } ) |
49
|
4
|
|
50
|
|
|
37
|
|| die "unable to open temp file: ".$self->{ headerFilename }; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
3793
|
100
|
|
|
|
14455
|
if ( $self->{ headerFileHandle }->eof() ) { |
53
|
4
|
|
|
|
|
99
|
$self->{ headerFileHandle }->close(); |
54
|
4
|
|
|
|
|
248
|
return( $self->handleResumptionToken( 'listIdentifiers' ) ); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
3789
|
|
|
|
|
34273
|
my $header = fd_retrieve( $self->{ headerFileHandle } ); |
58
|
3789
|
|
|
|
|
1094637
|
return( $header ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
## SAX Handlers |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub start_element { |
64
|
27124
|
|
|
27124
|
1
|
165476
|
my ( $self, $element ) = @_; |
65
|
27124
|
100
|
|
|
|
71324
|
if ( $element->{ Name } eq 'header' ) { |
66
|
5789
|
|
|
|
|
18071
|
$self->{ OLD_Handler } = $self->get_handler(); |
67
|
5789
|
|
|
|
|
55137
|
$self->set_handler( Net::OAI::Record::Header->new() ); |
68
|
|
|
|
|
|
|
} |
69
|
27124
|
|
|
|
|
134487
|
$self->SUPER::start_element( $element ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub end_element { |
73
|
27124
|
|
|
27124
|
1
|
161907
|
my ( $self, $element ) = @_; |
74
|
27124
|
|
|
|
|
76312
|
$self->SUPER::end_element( $element ); |
75
|
27124
|
100
|
|
|
|
156815
|
if ( $element->{ Name } eq 'header' ) { |
|
|
100
|
|
|
|
|
|
76
|
5789
|
|
|
|
|
19508
|
my $header = $self->get_handler(); |
77
|
5789
|
|
|
|
|
56599
|
Net::OAI::Harvester::debug( "committing header to object store" ); |
78
|
5789
|
|
|
|
|
27462
|
store_fd( $header, $self->{ headerFileHandle } ); |
79
|
5789
|
|
|
|
|
4938316
|
$self->set_handler( $self->{ OLD_Handler } ); |
80
|
|
|
|
|
|
|
} elsif ( $element->{ Name } eq 'ListIdentifiers' ) { |
81
|
6
|
|
|
|
|
24
|
Net::OAI::Harvester::debug( "finished reading identifiers" ); |
82
|
6
|
|
|
|
|
104
|
$self->{ headerFileHandle }->close(); |
83
|
6
|
|
|
|
|
1116
|
$self->{ headerFileHandle } = undef; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|