| 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.4001'; | |||||||||||||||||
| 10 | 1 | ▶ | use parent qw(BZ::Client::XMLRPC::Handler); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 11 | |||||||||||||||||||
| 12 | sub init { | ||||||||||||||||||
| 13 | 0 | ▶ | my($self,$parser) = @_; | ||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 14 | 0 | $self->SUPER::init($parser); | |||||||||||||||||
| 15 | 0 | $self->{'result'} = [] | |||||||||||||||||
| 16 | } | ||||||||||||||||||
| 17 | |||||||||||||||||||
| 18 | sub start { | ||||||||||||||||||
| 19 | 0 | ▶ | my($self,$name) = @_; | ||||||||||||||||
|
Subroutine
start: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||
| 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 | } elsif ($l == 1) { | ||||||||||||||||||
| 26 | 0 | ▶ | if ('data' ne $name) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 27 | 0 | $self->error("Expected array/data element, got $name"); | |||||||||||||||||
| 28 | } | ||||||||||||||||||
| 29 | } elsif ($l == 2) { | ||||||||||||||||||
| 30 | 0 | ▶ | if ('value' eq $name) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 31 | 0 | my $handler = BZ::Client::XMLRPC::Value->new(); | |||||||||||||||||
| 32 | $self->parser()->register($self, $handler, sub { | ||||||||||||||||||
| 33 | 0 | ▶ | my $array = $self->{'result'}; | ||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||
| 34 | 0 | push(@$array, $handler->result()); | |||||||||||||||||
| 35 | 0 | $array; | |||||||||||||||||
| 36 | 0 | }); | |||||||||||||||||
| 37 | 0 | $handler->start($name); | |||||||||||||||||
| 38 | } else { | ||||||||||||||||||
| 39 | 0 | $self->error("Expected array/data/value, got $name"); | |||||||||||||||||
| 40 | } | ||||||||||||||||||
| 41 | } else { | ||||||||||||||||||
| 42 | 0 | $self->error("Unexpected level $l with element $name"); | |||||||||||||||||
| 43 | } | ||||||||||||||||||
| 44 | 0 | return $l | |||||||||||||||||
| 45 | } | ||||||||||||||||||
| 46 | |||||||||||||||||||
| 47 | sub result { | ||||||||||||||||||
| 48 | 0 | ▶ | my $self = shift; | ||||||||||||||||
|
Subroutine
result: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||
| 49 | 0 | return $self->{'result'} | |||||||||||||||||
| 50 | } | ||||||||||||||||||
| 51 | |||||||||||||||||||
| 52 | 1 | 1; | |||||||||||||||||
| 53 | |||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||
| 55 | |||||||||||||||||||
| 56 | =pod | ||||||||||||||||||
| 57 | |||||||||||||||||||
| 58 | =encoding UTF-8 | ||||||||||||||||||
| 59 | |||||||||||||||||||
| 60 | =head1 NAME | ||||||||||||||||||
| 61 | |||||||||||||||||||
| 62 | BZ::Client::XMLRPC::Array - Event handler for parsing a single XML-RPC array. | ||||||||||||||||||
| 63 | |||||||||||||||||||
| 64 | =head1 VERSION | ||||||||||||||||||
| 65 | |||||||||||||||||||
| 66 | version 4.4001 | ||||||||||||||||||
| 67 | |||||||||||||||||||
| 68 | =head1 AUTHORS | ||||||||||||||||||
| 69 | |||||||||||||||||||
| 70 | =over 4 | ||||||||||||||||||
| 71 | |||||||||||||||||||
| 72 | =item * | ||||||||||||||||||
| 73 | |||||||||||||||||||
| 74 | Dean Hamstead <dean@bytefoundry.com.au> | ||||||||||||||||||
| 75 | |||||||||||||||||||
| 76 | =item * | ||||||||||||||||||
| 77 | |||||||||||||||||||
| 78 | Jochen Wiedmann <jochen.wiedmann@gmail.com> | ||||||||||||||||||
| 79 | |||||||||||||||||||
| 80 | =back | ||||||||||||||||||
| 81 | |||||||||||||||||||
| 82 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||
| 83 | |||||||||||||||||||
| 84 | This software is copyright (c) 2017 by Dean Hamstad. | ||||||||||||||||||
| 85 | |||||||||||||||||||
| 86 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||
| 87 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||
| 88 | |||||||||||||||||||
| 89 | =cut | ||||||||||||||||||