line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/bin/false |
2
|
|
|
|
|
|
|
# PODNAME: BZ::Client::XMLRPC::Value |
3
|
|
|
|
|
|
|
# ABSTRACT: Event handler for parsing a single XML-RPC value. |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package BZ::Client::XMLRPC::Value; |
9
|
|
|
|
|
|
|
$BZ::Client::XMLRPC::Value::VERSION = '4.4001_003'; # TRIAL |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
3
|
$BZ::Client::XMLRPC::Value::VERSION = '4.4001003';use parent qw( BZ::Client::XMLRPC::Handler ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
12
|
1
|
|
|
1
|
|
413
|
use BZ::Client::XMLRPC::Struct; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
13
|
1
|
|
|
1
|
|
387
|
use BZ::Client::XMLRPC::Array; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
14
|
1
|
|
|
1
|
|
544
|
use DateTime::Format::ISO8601 (); |
|
1
|
|
|
|
|
391232
|
|
|
1
|
|
|
|
|
625
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub start { |
17
|
0
|
|
|
0
|
0
|
|
my ( $self, $name ) = @_; |
18
|
0
|
|
|
|
|
|
my $l = $self->inc_level(); |
19
|
0
|
0
|
|
|
|
|
if ( $l == 0 ) { |
|
|
0
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if ( 'value' ne $name ) { |
21
|
0
|
|
|
|
|
|
$self->error("Expected value element, got $name"); |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
$self->{'level0_content'} = q(); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif ( $l == 1 ) { |
26
|
0
|
0
|
0
|
|
|
|
if ( 'struct' eq $name ) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $handler = BZ::Client::XMLRPC::Struct->new(); |
28
|
|
|
|
|
|
|
$self->parser()->register( |
29
|
|
|
|
|
|
|
$self, $handler, |
30
|
|
|
|
|
|
|
sub { |
31
|
0
|
|
|
0
|
|
|
$self->{'result'} = $handler->result(); |
32
|
|
|
|
|
|
|
} |
33
|
0
|
|
|
|
|
|
); |
34
|
0
|
|
|
|
|
|
$handler->start($name); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
elsif ( 'array' eq $name ) { |
37
|
0
|
|
|
|
|
|
my $handler = BZ::Client::XMLRPC::Array->new(); |
38
|
|
|
|
|
|
|
$self->parser()->register( |
39
|
|
|
|
|
|
|
$self, $handler, |
40
|
|
|
|
|
|
|
sub { |
41
|
0
|
|
|
0
|
|
|
$self->{'result'} = $handler->result(); |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
); |
44
|
0
|
|
|
|
|
|
$handler->start($name); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
elsif ('i4' eq $name |
47
|
|
|
|
|
|
|
|| 'int' eq $name |
48
|
|
|
|
|
|
|
|| 'string' eq $name |
49
|
|
|
|
|
|
|
|| 'double' eq $name |
50
|
|
|
|
|
|
|
|| 'dateTime.iso8601' eq $name |
51
|
|
|
|
|
|
|
|| 'base64' eq $name |
52
|
|
|
|
|
|
|
|| 'boolean' eq $name ) |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
|
|
|
$self->{'level1_elem'} = $name; |
55
|
0
|
|
|
|
|
|
$self->{'level1_content'} = q(); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
else { |
58
|
0
|
|
|
|
|
|
$self->error( |
59
|
|
|
|
|
|
|
"Expected struct|array|i4|int|boolean|string|double|dateTime.iso8601|base64 element, got $name" |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else { |
64
|
0
|
|
|
|
|
|
$self->error("Unexpected element $name at level $l"); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub end { |
69
|
0
|
|
|
0
|
0
|
|
my ( $self, $name ) = @_; |
70
|
0
|
|
|
|
|
|
my $l = $self->level(); |
71
|
0
|
0
|
|
|
|
|
if ( $l == 1 ) { |
|
|
0
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
my $content = $self->{'level0_content'}; |
73
|
0
|
0
|
|
|
|
|
if ( defined( $self->{'result'} ) ) { |
74
|
0
|
0
|
|
|
|
|
if ( $content !~ m/^\s*$/s ) { |
75
|
0
|
|
|
|
|
|
$self->error('Unexpected non-whitespace content'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else { |
79
|
0
|
|
|
|
|
|
$self->{'result'} = $content; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif ( $l == 2 ) { |
83
|
0
|
|
|
|
|
|
my $name = $name; |
84
|
0
|
0
|
|
|
|
|
if ( defined($name) ) { |
85
|
0
|
|
|
|
|
|
$self->{'result'} = $self->{'level1_content'}; |
86
|
0
|
|
|
|
|
|
$self->{'level1_content'} = undef; |
87
|
0
|
|
|
|
|
|
$self->{'level1_elem'} = undef; |
88
|
0
|
0
|
|
|
|
|
if ( 'dateTime.iso8601' eq $name ) { |
89
|
0
|
|
|
|
|
|
my $val = $self->{'result'}; |
90
|
0
|
0
|
|
|
|
|
if ( $val =~ m/(\d\d\d\d)(\d\d)(\d\d)(T\d\d:\d\d:\d\d)/ ) |
91
|
|
|
|
|
|
|
{ # See https://rt.cpan.org/Public/Bug/Display.html?id=78467 |
92
|
0
|
|
|
|
|
|
$val = "$1-$2-$3$4"; |
93
|
|
|
|
|
|
|
} |
94
|
0
|
|
|
|
|
|
$self->{'result'} = |
95
|
|
|
|
|
|
|
DateTime::Format::ISO8601->parse_datetime($val)->set_time_zone('UTC'); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
0
|
|
|
|
|
|
return $self->SUPER::end($name) |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub characters { |
103
|
0
|
|
|
0
|
0
|
|
my ( $self, $text ) = @_; |
104
|
0
|
|
|
|
|
|
my $l = $self->level(); |
105
|
0
|
0
|
|
|
|
|
if ( $l == 1 ) { |
|
|
0
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$self->{'level0_content'} .= $text; |
107
|
|
|
|
|
|
|
return |
108
|
0
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
elsif ( $l == 2 ) { |
110
|
0
|
|
|
|
|
|
my $l1_elem = $self->{'level1_elem'}; |
111
|
0
|
0
|
|
|
|
|
if ( defined($l1_elem) ) { |
112
|
0
|
|
|
|
|
|
$self->{'level1_content'} .= $text; |
113
|
|
|
|
|
|
|
return |
114
|
0
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
0
|
|
|
|
|
|
$self->SUPER::characters($text); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub result { |
120
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
121
|
0
|
|
|
|
|
|
my $res = $self->{'result'}; |
122
|
0
|
0
|
|
|
|
|
$res = defined($res) ? $res : q(); |
123
|
0
|
|
|
|
|
|
return $res |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=pod |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=encoding UTF-8 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 NAME |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
BZ::Client::XMLRPC::Value - Event handler for parsing a single XML-RPC value. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 VERSION |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
version 4.4001_003 |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 AUTHORS |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=over 4 |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Dean Hamstead <dean@bytefoundry.com.au> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Jochen Wiedmann <jochen.wiedmann@gmail.com> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Dean Hamstad. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
161
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |