line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::OAI::Record; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
@ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base ); |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
66
|
use strict; |
|
11
|
|
|
|
|
241
|
|
|
11
|
|
|
|
|
6048
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.12'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
11
|
|
|
11
|
1
|
31
|
my ($class,%args) = @_; |
11
|
|
|
|
|
|
|
|
12
|
11
|
|
33
|
|
|
75
|
$args{header} ||= HTTP::OAI::Header->new(%args); |
13
|
|
|
|
|
|
|
|
14
|
11
|
|
|
|
|
39
|
return $class->SUPER::new(%args); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
35
|
|
|
35
|
0
|
466
|
sub header { shift->_elem('header',@_) } |
18
|
18
|
|
|
18
|
0
|
603
|
sub metadata { shift->_elem('metadata',@_) } |
19
|
3
|
|
|
3
|
0
|
32
|
sub about { shift->_multi('about',@_) } |
20
|
|
|
|
|
|
|
|
21
|
18
|
|
|
18
|
1
|
719
|
sub identifier { shift->header->identifier(@_) } |
22
|
1
|
|
|
1
|
1
|
621
|
sub datestamp { shift->header->datestamp(@_) } |
23
|
1
|
|
|
1
|
1
|
385
|
sub status { shift->header->status(@_) } |
24
|
0
|
|
|
0
|
1
|
0
|
sub is_deleted { shift->header->is_deleted(@_) } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub generate |
27
|
|
|
|
|
|
|
{ |
28
|
1
|
|
|
1
|
0
|
2
|
my( $self, $driver ) = @_; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
4
|
$driver->start_element('record'); |
31
|
1
|
|
|
|
|
66
|
$self->header->generate( $driver ); |
32
|
1
|
50
|
|
|
|
10
|
$self->metadata->generate( $driver ) if defined $self->metadata; |
33
|
1
|
|
|
|
|
11
|
$self->about->generate( $driver ) for $self->about; |
34
|
1
|
|
|
|
|
3
|
$driver->end_element('record'); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub start_element { |
38
|
197
|
|
|
197
|
1
|
1231
|
my ($self,$hash, $r) = @_; |
39
|
|
|
|
|
|
|
|
40
|
197
|
100
|
|
|
|
347
|
if( !$self->{in_record} ) |
41
|
|
|
|
|
|
|
{ |
42
|
32
|
|
|
|
|
70
|
my $elem = lc($hash->{LocalName}); |
43
|
32
|
50
|
66
|
|
|
193
|
if( $elem eq 'record' && $hash->{Attributes}->{'{}status'}->{Value} ) |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
0
|
$self->status($hash->{Attributes}->{'{}status'}->{Value}); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
elsif( $elem eq "header" ) |
48
|
|
|
|
|
|
|
{ |
49
|
10
|
|
|
|
|
30
|
$self->set_handler(my $handler = HTTP::OAI::Header->new); |
50
|
10
|
|
|
|
|
170
|
$self->header( $handler ); |
51
|
10
|
|
|
|
|
109
|
$self->{in_record} = $hash->{Depth}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
elsif( $elem =~ /^metadata|about$/ ) |
54
|
|
|
|
|
|
|
{ |
55
|
12
|
|
100
|
|
|
35
|
my $class = $r->handlers->{$elem} || "HTTP::OAI::Metadata"; |
56
|
12
|
|
|
|
|
152
|
$self->set_handler(my $handler = $class->new); |
57
|
12
|
|
|
|
|
142
|
$self->$elem($handler); |
58
|
12
|
|
|
|
|
74
|
$self->{in_record} = $hash->{Depth}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
197
|
|
|
|
|
345
|
$self->SUPER::start_element($hash, $r); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub end_element { |
66
|
197
|
|
|
197
|
1
|
1183
|
my ($self,$hash, $r) = @_; |
67
|
|
|
|
|
|
|
|
68
|
197
|
|
|
|
|
419
|
$self->SUPER::end_element($hash, $r); |
69
|
|
|
|
|
|
|
|
70
|
197
|
100
|
|
|
|
1954
|
if( $self->{in_record} == $hash->{Depth} ) |
71
|
|
|
|
|
|
|
{ |
72
|
22
|
|
|
|
|
60
|
$self->set_handler( undef ); |
73
|
22
|
|
|
|
|
331
|
$self->{in_record} = 0; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |