line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::ListIdentifiers; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
79
|
use strict; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
463
|
|
4
|
16
|
|
|
16
|
|
75
|
use base qw( XML::SAX::Base Net::OAI::Base ); |
|
16
|
|
|
|
|
72
|
|
|
16
|
|
|
|
|
1483
|
|
5
|
16
|
|
|
16
|
|
77
|
use Carp qw ( croak ); |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
788
|
|
6
|
16
|
|
|
16
|
|
9373
|
use Net::OAI::Record::Header; |
|
16
|
|
|
|
|
39
|
|
|
16
|
|
|
|
|
428
|
|
7
|
16
|
|
|
16
|
|
90
|
use File::Temp qw( tempfile ); |
|
16
|
|
|
|
|
26
|
|
|
16
|
|
|
|
|
737
|
|
8
|
16
|
|
|
16
|
|
11754
|
use IO::File; |
|
16
|
|
|
|
|
15149
|
|
|
16
|
|
|
|
|
2873
|
|
9
|
16
|
|
|
16
|
|
122
|
use Storable qw( store_fd fd_retrieve ); |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
8870
|
|
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
|
|
|
|
|
|
|
This class is based on C and inherits the general methods |
22
|
|
|
|
|
|
|
expect for the following: |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 new() |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
29
|
6
|
|
|
6
|
1
|
41
|
my ( $class, %opts ) = @_; |
30
|
6
|
|
33
|
|
|
74
|
my $self = bless \%opts, ref( $class ) || $class; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
## open a temp file for storing identifiers |
33
|
6
|
|
|
|
|
58
|
my ($fh,$filename) = tempfile(UNLINK => 1); |
34
|
6
|
|
|
|
|
5185
|
$self->{ headerFileHandle } = $fh; |
35
|
6
|
|
|
|
|
28
|
$self->{ headerFilename } = $filename; |
36
|
|
|
|
|
|
|
## so we can store code refs |
37
|
6
|
|
|
|
|
18
|
$Storable::Deparse = 1; |
38
|
6
|
|
|
|
|
19
|
$Storable::Eval = 1; |
39
|
6
|
|
|
|
|
39
|
return( $self ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 next() |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Returns the L object for the next OAI record in the |
45
|
|
|
|
|
|
|
response, C if none remain. resumptionToken handling is performed |
46
|
|
|
|
|
|
|
automagically if the original request was listAllIdentifiers(). |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub next { |
51
|
2003
|
|
|
2003
|
1
|
343608
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
2003
|
100
|
|
|
|
6225
|
if ( ! $self->{ headerFileHandle } ) { |
54
|
|
|
|
|
|
|
$self->{ headerFileHandle } = IO::File->new( $self->{ headerFilename } ) |
55
|
3
|
50
|
|
|
|
30
|
or croak "unable to open temp file: ".$self->{ headerFilename }; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
2003
|
100
|
|
|
|
7687
|
if ( $self->{ headerFileHandle }->eof() ) { |
59
|
|
|
|
|
|
|
$self->{ headerFileHandle }->close() or croak "Could not close() ".$self->{ headerFilename } |
60
|
2
|
50
|
|
|
|
34
|
.". File system full?"; |
61
|
2
|
|
|
|
|
194
|
return( $self->handleResumptionToken( 'listIdentifiers' ) ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
2001
|
|
|
|
|
16598
|
my $header = fd_retrieve( $self->{ headerFileHandle } ); |
65
|
2001
|
|
|
|
|
62490
|
return( $header ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
## SAX Handlers |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub start_element { |
71
|
23163
|
|
|
23163
|
1
|
131626
|
my ( $self, $element ) = @_; |
72
|
23163
|
50
|
|
|
|
53316
|
return $self->SUPER::start_element( $element ) unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; |
73
|
|
|
|
|
|
|
|
74
|
23163
|
100
|
|
|
|
63552
|
if ( $element->{ LocalName } eq 'header' ) { |
|
|
100
|
|
|
|
|
|
75
|
5000
|
|
|
|
|
12608
|
$self->{ OLD_Handler } = $self->get_handler(); |
76
|
5000
|
|
|
|
|
40758
|
$self->set_handler( Net::OAI::Record::Header->new() ); |
77
|
|
|
|
|
|
|
} elsif ( $element->{ LocalName } eq 'ListIdentifiers' ) { |
78
|
|
|
|
|
|
|
} |
79
|
23163
|
|
|
|
|
102650
|
$self->SUPER::start_element( $element ); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub end_element { |
83
|
23163
|
|
|
23163
|
1
|
130896
|
my ( $self, $element ) = @_; |
84
|
23163
|
|
|
|
|
51467
|
$self->SUPER::end_element( $element ); |
85
|
23163
|
50
|
|
|
|
57094
|
return unless $element->{NamespaceURI} eq Net::OAI::Harvester::XMLNS_OAI; |
86
|
|
|
|
|
|
|
|
87
|
23163
|
100
|
|
|
|
109132
|
if ( $element->{ LocalName } eq 'header' ) { |
|
|
100
|
|
|
|
|
|
88
|
5000
|
|
|
|
|
12729
|
my $header = $self->get_handler(); |
89
|
5000
|
|
|
|
|
39668
|
Net::OAI::Harvester::debug( "committing header to object store" ); |
90
|
5000
|
|
|
|
|
14452
|
store_fd( $header, $self->{ headerFileHandle } ); |
91
|
5000
|
|
|
|
|
468071
|
$self->set_handler( $self->{ OLD_Handler } ); |
92
|
|
|
|
|
|
|
} elsif ( $element->{ LocalName } eq 'ListIdentifiers' ) { |
93
|
5
|
|
|
|
|
18
|
Net::OAI::Harvester::debug( "finished reading identifiers" ); |
94
|
5
|
|
|
|
|
62
|
$self->{ headerFileHandle }->close(); |
95
|
5
|
|
|
|
|
552
|
$self->{ headerFileHandle } = undef; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|