line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::OAI::Header; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
@ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base ); |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
72
|
use strict; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
524
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.11'; |
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
|
86
|
use POSIX qw/strftime/; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
104
|
|
10
|
|
|
|
|
|
|
|
11
|
33
|
|
|
33
|
1
|
292
|
sub identifier { shift->_elem('identifier',@_) } |
12
|
|
|
|
|
|
|
sub datestamp { |
13
|
15
|
|
|
15
|
1
|
36
|
my $self = shift; |
14
|
15
|
100
|
|
|
|
52
|
return $self->_elem('datestamp') unless @_; |
15
|
13
|
50
|
|
|
|
35
|
my $ds = shift or return $self->_elem('datestamp',undef); |
16
|
13
|
50
|
|
|
|
98
|
if( $ds =~ /^(\d{4})(\d{2})(\d{2})$/ ) { |
|
|
50
|
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
$ds = "$1-$2-$3"; |
18
|
|
|
|
|
|
|
} elsif( $ds =~ /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ ) { |
19
|
0
|
|
|
|
|
0
|
$ds = "$1-$2-$3T$4:$5:$6Z"; |
20
|
|
|
|
|
|
|
} |
21
|
13
|
|
|
|
|
41
|
return $self->_elem('datestamp',$ds); |
22
|
|
|
|
|
|
|
} |
23
|
16
|
|
|
16
|
1
|
64
|
sub status { shift->_elem('status',@_) } |
24
|
14
|
|
|
14
|
1
|
65
|
sub setSpec { shift->_multi('setSpec',@_) } |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
0
|
0
|
sub now { return strftime("%Y-%m-%dT%H:%M:%SZ",gmtime()) } |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
0
|
0
|
1
|
0
|
sub is_deleted { my $s = shift->status(); return defined($s) && $s eq 'deleted'; } |
|
0
|
|
|
|
|
0
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub generate |
31
|
|
|
|
|
|
|
{ |
32
|
1
|
|
|
1
|
1
|
16
|
my ($self, $driver) = @_; |
33
|
|
|
|
|
|
|
|
34
|
1
|
50
|
|
|
|
5
|
if( defined($self->status) ) { |
35
|
1
|
|
|
|
|
11
|
$driver->start_element( 'header', status => $self->status ); |
36
|
|
|
|
|
|
|
} else { |
37
|
0
|
|
|
|
|
0
|
$driver->start_element( 'header' ); |
38
|
|
|
|
|
|
|
} |
39
|
1
|
|
|
|
|
81
|
$driver->data_element( 'identifier', $self->identifier ); |
40
|
1
|
|
33
|
|
|
12
|
$driver->data_element( 'datestamp', ($self->datestamp || $self->now) ); |
41
|
1
|
|
|
|
|
10
|
for($self->setSpec) |
42
|
|
|
|
|
|
|
{ |
43
|
2
|
|
|
|
|
11
|
$driver->data_element( 'setSpec', $_ ); |
44
|
|
|
|
|
|
|
} |
45
|
1
|
|
|
|
|
10
|
$driver->end_element( 'header' ); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub end_element { |
49
|
51
|
|
|
51
|
1
|
517
|
my ($self,$hash) = @_; |
50
|
51
|
|
|
|
|
128
|
my $elem = lc($hash->{LocalName}); |
51
|
51
|
|
|
|
|
81
|
my $text = $hash->{Text}; |
52
|
51
|
50
|
|
|
|
111
|
if( defined $text ) |
53
|
|
|
|
|
|
|
{ |
54
|
51
|
|
|
|
|
124
|
$text =~ s/^\s+//; |
55
|
51
|
|
|
|
|
122
|
$text =~ s/\s+$//; |
56
|
|
|
|
|
|
|
} |
57
|
51
|
100
|
|
|
|
203
|
if( $elem eq 'identifier' ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
58
|
13
|
|
|
|
|
54
|
$self->identifier($text); |
59
|
|
|
|
|
|
|
} elsif( $elem eq 'datestamp' ) { |
60
|
13
|
|
|
|
|
49
|
$self->datestamp($text); |
61
|
|
|
|
|
|
|
} elsif( $elem eq 'setspec' ) { |
62
|
12
|
|
|
|
|
38
|
$self->setSpec($text); |
63
|
|
|
|
|
|
|
} elsif( $elem eq 'header' ) { |
64
|
13
|
|
|
|
|
67
|
$self->status($hash->{Attributes}->{'{}status'}->{Value}); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |