| 1 | #!/bin/false | ||||||||||||||||||
| 2 | # PODNAME: BZ::Client::XMLRPC::Array | ||||||||||||||||||
| 3 | # ABSTRACT: Event handler for parsing a single XML-RPC array. | ||||||||||||||||||
| 4 | |||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 6 | 1 | ▶ | use warnings 'all'; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 7 | |||||||||||||||||||
| 8 | package BZ::Client::XMLRPC::Array; | ||||||||||||||||||
| 9 | 1 | $BZ::Client::XMLRPC::Array::VERSION = '4.91'; | |||||||||||||||||
| 10 | 1 | ▶ | use parent qw(BZ::Client::XMLRPC::Handler); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | 0 | ▶ | sub init { | ||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 13 | 0 | my($self,$parser) = @_; | |||||||||||||||||
| 14 | 0 | $self->SUPER::init($parser); | |||||||||||||||||
| 15 | 0 | $self->{'result'} = [] | |||||||||||||||||
| 16 | } | ||||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | 0 | ▶ | sub start { | ||||||||||||||||
|
Subroutine
start: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||
| 19 | 0 | my($self,$name) = @_; | |||||||||||||||||
| 20 | 0 | my $l = $self->inc_level(); | |||||||||||||||||
| 21 | 0 | ▶ | if ($l == 0) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 22 | 0 | ▶ | if ('array' ne $name) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 23 | 0 | $self->error("Expected array element, got $name"); | |||||||||||||||||
| 24 | } | ||||||||||||||||||
| 25 | } | ||||||||||||||||||
| 26 | elsif ($l == 1) { | ||||||||||||||||||
| 27 | 0 | ▶ | if ('data' ne $name) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 28 | 0 | $self->error("Expected array/data element, got $name"); | |||||||||||||||||
| 29 | } | ||||||||||||||||||
| 30 | } | ||||||||||||||||||
| 31 | elsif ($l == 2) { | ||||||||||||||||||
| 32 | 0 | ▶ | if ('value' eq $name) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 33 | 0 | my $handler = BZ::Client::XMLRPC::Value->new(); | |||||||||||||||||
| 34 | 0 | ▶ | $self->parser()->register($self, $handler, sub { | ||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||
| 35 | 0 | my $array = $self->{'result'}; | |||||||||||||||||
| 36 | 0 | push(@$array, $handler->result()); | |||||||||||||||||
| 37 | 0 | $array; | |||||||||||||||||
| 38 | 0 | }); | |||||||||||||||||
| 39 | 0 | $handler->start($name); | |||||||||||||||||
| 40 | } | ||||||||||||||||||
| 41 | else { | ||||||||||||||||||
| 42 | 0 | $self->error("Expected array/data/value, got $name"); | |||||||||||||||||
| 43 | } | ||||||||||||||||||
| 44 | } | ||||||||||||||||||
| 45 | else { | ||||||||||||||||||
| 46 | 0 | $self->error("Unexpected level $l with element $name"); | |||||||||||||||||
| 47 | } | ||||||||||||||||||
| 48 | 0 | return $l | |||||||||||||||||
| 49 | } | ||||||||||||||||||
| 50 | |||||||||||||||||||
| 51 | 0 | ▶ | sub result { | ||||||||||||||||
|
Subroutine
result: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 52 | 0 | my $self = shift; | |||||||||||||||||
| 53 | 0 | return $self->{'result'} | |||||||||||||||||
| 54 | } | ||||||||||||||||||
| 55 | |||||||||||||||||||
| 56 | 1 | 1; | |||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||