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
|
|
65
|
use strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
1291
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '4.12'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# back compatibility |
10
|
|
|
|
|
|
|
sub toDOM { |
11
|
2
|
|
|
2
|
0
|
210
|
shift->dom; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub errors { |
15
|
0
|
|
|
0
|
0
|
0
|
shift->_multi('error',@_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub xslt { |
19
|
2
|
|
|
2
|
0
|
6
|
my ($self,$xslt) = @_; |
20
|
2
|
50
|
|
|
|
6
|
$self->{xslt} = $xslt if defined($xslt); |
21
|
2
|
|
|
|
|
8
|
$self->{xslt}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
for(qw( parse_string parse_file )) |
25
|
|
|
|
|
|
|
{ |
26
|
11
|
|
|
11
|
|
72
|
no strict; |
|
11
|
|
|
|
|
20
|
|
|
11
|
|
|
|
|
3322
|
|
27
|
|
|
|
|
|
|
my $fn = $_; |
28
|
|
|
|
|
|
|
*$fn = sub { |
29
|
6
|
|
|
6
|
|
510
|
my( $self, $io ) = @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $r = HTTP::OAI::Response->new( |
32
|
|
|
|
|
|
|
verb => $self->verb, |
33
|
|
|
|
|
|
|
handlers => $self->{handlers}, |
34
|
6
|
|
|
|
|
28
|
); |
35
|
6
|
|
|
|
|
31
|
$r->$fn( $io ); |
36
|
6
|
50
|
|
|
|
25
|
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
|
|
|
|
|
300
|
my $content = ($r->content)[-1]; |
47
|
|
|
|
|
|
|
# HACK HACK HACK |
48
|
6
|
|
|
|
|
155
|
%$self = %$content; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub verb |
54
|
|
|
|
|
|
|
{ |
55
|
10
|
|
|
10
|
0
|
26
|
my $class = ref($_[0]); |
56
|
10
|
|
|
|
|
61
|
$class =~ s/^.*:://; |
57
|
10
|
|
|
|
|
96
|
return $class; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub generate |
61
|
|
|
|
|
|
|
{ |
62
|
2
|
|
|
2
|
0
|
5
|
my( $self, $driver ) = @_; |
63
|
|
|
|
|
|
|
|
64
|
2
|
50
|
|
|
|
10
|
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
|
|
|
|
|
10
|
$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
|
|
|
|
|
378
|
$driver->start_element( $self->verb ); |
75
|
2
|
|
|
|
|
124
|
$self->generate_body( $driver ); |
76
|
2
|
|
|
|
|
45
|
$driver->end_element( $self->verb ); |
77
|
2
|
|
|
|
|
33
|
$driver->end_element( 'OAI-PMH' ); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |