line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::OAI::GetRecord; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
77
|
use strict; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
489
|
|
4
|
14
|
|
|
14
|
|
77
|
use base qw( XML::SAX::Base ); |
|
14
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
1128
|
|
5
|
14
|
|
|
14
|
|
77
|
use base qw( Net::OAI::Base ); |
|
14
|
|
|
|
|
24
|
|
|
14
|
|
|
|
|
829
|
|
6
|
14
|
|
|
14
|
|
76
|
use Net::OAI::Record::Header; |
|
14
|
|
|
|
|
26
|
|
|
14
|
|
|
|
|
8685
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Net::OAI::GetRecord - The results of a GetRecord OAI-PMH verb. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 new() |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
3
|
|
|
3
|
1
|
15
|
my ( $class, %opts ) = @_; |
24
|
3
|
|
33
|
|
|
33
|
my $self = bless \%opts, ref( $class ) || $class; |
25
|
3
|
|
|
|
|
34
|
$self->{ insideHeader } = 0; |
26
|
3
|
|
|
|
|
9
|
$self->{ insideSet } = 0; |
27
|
3
|
|
|
|
|
7
|
$self->{ header } = undef; |
28
|
3
|
|
|
|
|
10
|
$self->{ setSpecs } = []; |
29
|
3
|
|
|
|
|
13
|
return( $self ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 header() |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub header { |
37
|
2
|
|
|
2
|
1
|
6
|
my $self = shift; |
38
|
2
|
|
|
|
|
7
|
return( $self->{ header } ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 metadata() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub metadata { |
46
|
2
|
|
|
2
|
1
|
51
|
my $self = shift; |
47
|
2
|
|
|
|
|
8
|
return( $self->{ metadata } ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
## SAX Handlers |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub start_element { |
53
|
0
|
|
|
0
|
1
|
|
my ( $self, $element ) = @_; |
54
|
0
|
|
|
|
|
|
my $tagName = $element->{ Name }; |
55
|
0
|
0
|
|
|
|
|
if ( $tagName eq 'header' ) { |
|
|
0
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$self->{ insideHeader } = 1; |
57
|
0
|
0
|
|
|
|
|
if ( exists( $element->{ Attributes }{ '{}status' } ) ) { |
58
|
0
|
|
|
|
|
|
$self->{ headerStatus } = $element->{ Attributes }{ '{}status' }; |
59
|
|
|
|
|
|
|
} else { |
60
|
0
|
|
|
|
|
|
$self->{ headerStatus } = ''; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif ( $tagName eq 'setSpec' ) { |
64
|
0
|
|
|
|
|
|
$self->{ insideSet } = 1; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
else { |
67
|
0
|
|
|
|
|
|
$self->SUPER::start_element( $element ); |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
push( @{ $self->{ tagStack } }, $element->{ Name } ); |
|
0
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub end_element { |
73
|
0
|
|
|
0
|
1
|
|
my ( $self, $element ) = @_; |
74
|
0
|
|
|
|
|
|
my $tagName = $element->{ Name }; |
75
|
0
|
0
|
|
|
|
|
if ( $tagName eq 'header' ) { |
|
|
0
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
Net:OAI::Harvester::debug( "found header" ); |
77
|
0
|
|
|
|
|
|
my $header = Net::OAI::Record::Header->new(); |
78
|
0
|
|
|
|
|
|
$header->status( $self->{ headerStatus } ); |
79
|
0
|
|
|
|
|
|
$header->identifier( $self->{ identifier } ); |
80
|
0
|
|
|
|
|
|
$header->datestamp( $self->{ datestamp } ); |
81
|
0
|
|
|
|
|
|
$header->sets( @{ $self->{ setSpecs } } ); |
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
push( @{ $self->{ headers } }, $header ); |
|
0
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
$self->{ insideHeader } = 0; |
84
|
0
|
|
|
|
|
|
$self->{ status } = ''; |
85
|
0
|
|
|
|
|
|
$self->{ identifier } = ''; |
86
|
0
|
|
|
|
|
|
$self->{ datestamp } = ''; |
87
|
0
|
|
|
|
|
|
$self->{ setSpec } = ''; |
88
|
0
|
|
|
|
|
|
$self->{ setSpecs } = []; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
elsif ( $tagName eq 'setSpec' ) { |
91
|
0
|
|
|
|
|
|
Net::OAI::Harvester::debug( "found setSpec" ); |
92
|
0
|
|
|
|
|
|
push( @{ $self->{ setSpecs } }, $self->{ setSpec } ); |
|
0
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
$self->{ insideSet } = 0; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
else { |
96
|
0
|
|
|
|
|
|
$self->SUPER::end_element( $element ); |
97
|
|
|
|
|
|
|
} |
98
|
0
|
|
|
|
|
|
pop( @{ $self->{ tagStack } } ); |
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub characters { |
102
|
0
|
|
|
0
|
1
|
|
my ( $self, $characters ) = @_; |
103
|
0
|
0
|
|
|
|
|
if ( $self->{ insideHeader } ) { |
104
|
0
|
|
|
|
|
|
$self->{ $self->{ tagStack }[-1] } .= $characters->{ Data }; |
105
|
|
|
|
|
|
|
} else { |
106
|
0
|
|
|
|
|
|
$self->SUPER::characters( $characters ); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|