line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/bin/false |
2
|
|
|
|
|
|
|
# PODNAME: BZ::Client::XMLRPC::Struct |
3
|
|
|
|
|
|
|
# ABSTRACT: Event handler for parsing a single XML-RPC struct. |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
16
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package BZ::Client::XMLRPC::Struct; |
9
|
|
|
|
|
|
|
$BZ::Client::XMLRPC::Struct::VERSION = '4.4001_002'; # TRIAL |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
3
|
$BZ::Client::XMLRPC::Struct::VERSION = '4.4001002';use parent qw(BZ::Client::XMLRPC::Handler ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init { |
14
|
0
|
|
|
0
|
0
|
|
my ($self, $parser) = @_; |
15
|
0
|
|
|
|
|
|
$self->SUPER::init($parser); |
16
|
0
|
|
|
|
|
|
$self->{'result'} = {} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub start { |
20
|
0
|
|
|
0
|
0
|
|
my($self,$name) = @_; |
21
|
0
|
|
|
|
|
|
my $l = $self->inc_level(); |
22
|
0
|
0
|
|
|
|
|
if ($l == 0) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ('struct' ne $name) { |
24
|
0
|
|
|
|
|
|
$self->error("Expected struct element, got $name"); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} elsif ($l == 1) { |
27
|
0
|
0
|
|
|
|
|
if ('member' ne $name) { |
28
|
0
|
|
|
|
|
|
$self->error("Expected struct/member element, got $name"); |
29
|
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
$self->{'current_name'} = undef; |
31
|
0
|
|
|
|
|
|
$self->{'parsing_name'} = undef; |
32
|
|
|
|
|
|
|
} elsif ($l == 2) { |
33
|
0
|
0
|
|
|
|
|
if ('name' eq $name) { |
|
|
0
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
$self->error("Multiple name elements in struct/member") if defined $self->{'parsing_name'}; |
35
|
0
|
|
|
|
|
|
$self->{'parsing_name'} = q(); |
36
|
|
|
|
|
|
|
} elsif ('value' eq $name) { |
37
|
0
|
|
|
|
|
|
my $current_name = $self->{'current_name'}; |
38
|
0
|
0
|
|
|
|
|
$self->error("Expected struct/member/name element, got value") unless defined $current_name; |
39
|
0
|
0
|
|
|
|
|
$self->error('Multiple value elements in struct/member, or multiple members with the same name.') if defined $self->{'result'}->{$current_name}; |
40
|
0
|
|
|
|
|
|
my $handler = BZ::Client::XMLRPC::Value->new(); |
41
|
|
|
|
|
|
|
$self->parser()->register($self, $handler, sub { |
42
|
0
|
|
|
0
|
|
|
$self->{'result'}->{$current_name} = $handler->result() |
43
|
0
|
|
|
|
|
|
}); |
44
|
0
|
|
|
|
|
|
$handler->start($name); |
45
|
|
|
|
|
|
|
} else { |
46
|
0
|
|
|
|
|
|
$self->error("Expected name|value element in struct/member, got $name"); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} else { |
49
|
0
|
|
|
|
|
|
$self->error("Unexpected level $l with element $name"); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub end { |
54
|
0
|
|
|
0
|
0
|
|
my($self,$name) = @_; |
55
|
0
|
|
|
|
|
|
my $l = $self->SUPER::end($name); |
56
|
0
|
0
|
0
|
|
|
|
if ($l == 2 && defined($self->{'parsing_name'})) { |
57
|
0
|
|
|
|
|
|
$self->{'current_name'} = $self->{'parsing_name'}; |
58
|
|
|
|
|
|
|
} |
59
|
0
|
|
|
|
|
|
return $l |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub characters { |
63
|
0
|
|
|
0
|
0
|
|
my($self, $text) = @_; |
64
|
0
|
|
|
|
|
|
my $l = $self->level(); |
65
|
0
|
0
|
0
|
|
|
|
if ($l == 3 && defined($self->{'parsing_name'})) { |
66
|
0
|
|
|
|
|
|
$self->{'parsing_name'} .= $text; |
67
|
|
|
|
|
|
|
} else { |
68
|
0
|
|
|
|
|
|
$self->SUPER::characters($text); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub result { |
73
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
return $self->{'result'} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding UTF-8 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
BZ::Client::XMLRPC::Struct - Event handler for parsing a single XML-RPC struct. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
version 4.4001_002 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHORS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over 4 |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Dean Hamstead <dean@bytefoundry.com.au> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Jochen Wiedmann <jochen.wiedmann@gmail.com> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Dean Hamstad. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
112
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |