line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/bin/false |
2
|
|
|
|
|
|
|
# PODNAME: BZ::Client::XMLRPC::Response |
3
|
|
|
|
|
|
|
# ABSTRACT: Event handler for parsing an XML-RPC response. |
4
|
|
|
|
|
|
|
# |
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package BZ::Client::XMLRPC::Response; |
9
|
|
|
|
|
|
|
$BZ::Client::XMLRPC::Response::VERSION = '4.4001_002'; # TRIAL |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
388
|
$BZ::Client::XMLRPC::Response::VERSION = '4.4001002';use parent qw( BZ::Client::XMLRPC::Handler ); |
|
1
|
|
|
|
|
227
|
|
|
1
|
|
|
|
|
4
|
|
12
|
1
|
|
|
1
|
|
383
|
use BZ::Client::XMLRPC::Value; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
13
|
1
|
|
|
1
|
|
10
|
use BZ::Client::Exception; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
367
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub start { |
16
|
0
|
|
|
0
|
0
|
|
my($self,$name) = @_; |
17
|
0
|
|
|
|
|
|
my $l = $self->inc_level(); |
18
|
0
|
0
|
|
|
|
|
if ($l == 0) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if ('methodResponse' ne $name) { |
20
|
0
|
|
|
|
|
|
$self->error("Expected methodResponse element, got $name"); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} elsif ($l == 1) { |
23
|
0
|
0
|
|
|
|
|
if ('fault' eq $name) { |
|
|
0
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$self->{'in_fault'} = 1; |
25
|
|
|
|
|
|
|
} elsif ('params' eq $name) { |
26
|
0
|
0
|
|
|
|
|
if (defined($self->{'result'})) { |
27
|
0
|
|
|
|
|
|
$self->error('Multiple elements methodResponse/params found.'); |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
$self->{'in_fault'} = 0; |
30
|
|
|
|
|
|
|
} else { |
31
|
0
|
|
|
|
|
|
$self->error("Unexpected element methodResponse/$name, expected fault|params"); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} elsif ($l == 2) { |
34
|
0
|
0
|
|
|
|
|
if ($self->{'in_fault'}) { |
35
|
0
|
0
|
|
|
|
|
if ('value' ne $name) { |
36
|
0
|
|
|
|
|
|
$self->error("Unexpected element methodResponse/fault/$name, expected value"); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
|
my $handler = BZ::Client::XMLRPC::Value->new(); |
39
|
|
|
|
|
|
|
$self->parser()->register($self, $handler, sub { |
40
|
0
|
|
|
0
|
|
|
my $result = $handler->result(); |
41
|
0
|
0
|
|
|
|
|
if ('HASH' ne ref($result)) { |
42
|
0
|
|
|
|
|
|
$self->error('Failed to parse XML-RPC response document: Error reported, but no faultCode and faultString found.'); |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
my $faultCode = $result->{'faultCode'}; |
45
|
0
|
|
|
|
|
|
my $faultString = $result->{'faultString'}; |
46
|
0
|
|
|
|
|
|
$self->{'exception'} = BZ::Client::Exception->new('message' => $faultString, |
47
|
|
|
|
|
|
|
'xmlrpc_code' => $faultCode); |
48
|
0
|
|
|
|
|
|
}); |
49
|
0
|
|
|
|
|
|
$handler->start($name); |
50
|
|
|
|
|
|
|
} else { |
51
|
0
|
0
|
|
|
|
|
if ('param' ne $name) { |
52
|
0
|
|
|
|
|
|
$self->error("Unexpected element methodResponse/params/$name, expected param"); |
53
|
|
|
|
|
|
|
} |
54
|
0
|
0
|
|
|
|
|
if (defined($self->{'result'})) { |
55
|
0
|
|
|
|
|
|
$self->error('Multiple elements methodResponse/params/param found.'); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} elsif ($l == 3) { |
59
|
0
|
0
|
|
|
|
|
if ($self->{'in_fault'}) { |
60
|
0
|
|
|
|
|
|
$self->error("Unexpected element $name found at level $l"); |
61
|
|
|
|
|
|
|
} else { |
62
|
0
|
0
|
|
|
|
|
if ('value' ne $name) { |
63
|
0
|
|
|
|
|
|
$self->error("Unexpected element methodResponse/params/param/$name, expected value"); |
64
|
|
|
|
|
|
|
} |
65
|
0
|
0
|
|
|
|
|
if (defined($self->{'result'})) { |
66
|
0
|
|
|
|
|
|
$self->error('Multiple elements methodResponse/params/param/value found.'); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
my $handler = BZ::Client::XMLRPC::Value->new(); |
69
|
|
|
|
|
|
|
$self->parser()->register($self, $handler, sub { |
70
|
0
|
|
|
0
|
|
|
$self->{'result'} = $handler->result(); |
71
|
0
|
|
|
|
|
|
}); |
72
|
0
|
|
|
|
|
|
$handler->start($name); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub end { |
78
|
0
|
|
|
0
|
0
|
|
my($self, $name) = @_; |
79
|
0
|
|
|
|
|
|
my $l = $self->SUPER::end($name); |
80
|
0
|
|
|
|
|
|
return $l |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub exception { |
84
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
85
|
0
|
|
|
|
|
|
return $self->{'exception'} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub result { |
89
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
90
|
0
|
|
|
|
|
|
return $self->{'result'} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=pod |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=encoding UTF-8 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 NAME |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
BZ::Client::XMLRPC::Response - Event handler for parsing an XML-RPC response. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 VERSION |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
version 4.4001_002 |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHORS |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=over 4 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Dean Hamstead <dean@bytefoundry.com.au> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Jochen Wiedmann <jochen.wiedmann@gmail.com> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=back |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Dean Hamstad. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
128
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |