line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::OAI::Verb; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
@ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base ); |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
76
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
1472
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.13'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# back compatibility |
10
|
|
|
|
|
|
|
sub toDOM { |
11
|
2
|
|
|
2
|
0
|
132
|
shift->dom; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub errors { |
15
|
0
|
|
|
0
|
0
|
0
|
shift->_multi('error',@_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub xslt { |
19
|
2
|
|
|
2
|
0
|
7
|
my ($self,$xslt) = @_; |
20
|
2
|
50
|
|
|
|
6
|
$self->{xslt} = $xslt if defined($xslt); |
21
|
2
|
|
|
|
|
13
|
$self->{xslt}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
for(qw( parse_string parse_file )) |
25
|
|
|
|
|
|
|
{ |
26
|
11
|
|
|
11
|
|
83
|
no strict; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
3887
|
|
27
|
|
|
|
|
|
|
my $fn = $_; |
28
|
|
|
|
|
|
|
*$fn = sub { |
29
|
6
|
|
|
6
|
|
557
|
my( $self, $io ) = @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $r = HTTP::OAI::Response->new( |
32
|
|
|
|
|
|
|
verb => $self->verb, |
33
|
|
|
|
|
|
|
handlers => $self->{handlers}, |
34
|
6
|
|
|
|
|
36
|
); |
35
|
6
|
|
|
|
|
39
|
$r->$fn( $io ); |
36
|
6
|
50
|
|
|
|
43
|
if( $r->is_error ) |
|
|
50
|
|
|
|
|
|
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
0
|
die "Error parsing: ".$r->code." ".$r->message; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
elsif( $r->error ) |
41
|
|
|
|
|
|
|
{ |
42
|
0
|
|
|
|
|
0
|
$self->errors( $r->error ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else |
45
|
|
|
|
|
|
|
{ |
46
|
6
|
|
|
|
|
385
|
my $content = ($r->content)[-1]; |
47
|
|
|
|
|
|
|
# HACK HACK HACK |
48
|
6
|
|
|
|
|
192
|
%$self = %$content; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub verb |
54
|
|
|
|
|
|
|
{ |
55
|
10
|
|
|
10
|
0
|
29
|
my $class = ref($_[0]); |
56
|
10
|
|
|
|
|
67
|
$class =~ s/^.*:://; |
57
|
10
|
|
|
|
|
109
|
return $class; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub generate |
61
|
|
|
|
|
|
|
{ |
62
|
2
|
|
|
2
|
0
|
6
|
my( $self, $driver ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
2
|
50
|
|
|
|
14
|
if( $self->xslt ) { |
65
|
0
|
|
|
|
|
0
|
$driver->processing_instruction({ |
66
|
|
|
|
|
|
|
'Target' => 'xml-stylesheet', |
67
|
|
|
|
|
|
|
'Data' => 'type=\'text/xsl\' href=\''. $self->xslt . '\'' |
68
|
|
|
|
|
|
|
}); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
24
|
$driver->start_element( 'OAI-PMH', |
72
|
|
|
|
|
|
|
'xsi:schemaLocation' => 'http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd', |
73
|
|
|
|
|
|
|
); |
74
|
2
|
|
|
|
|
478
|
$driver->start_element( $self->verb ); |
75
|
2
|
|
|
|
|
155
|
$self->generate_body( $driver ); |
76
|
2
|
|
|
|
|
34
|
$driver->end_element( $self->verb ); |
77
|
2
|
|
|
|
|
21
|
$driver->end_element( 'OAI-PMH' ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |