File Coverage

blib/lib/BZ/Client/XMLRPC/Array.pm
Criterion Covered Total %
statement 9 31 29.0
branch 0 12 0.0
condition n/a
subroutine 3 7 42.8
pod 0 3 0.0
total 12 53 22.6


line stmt bran cond sub pod time code
1             #!/bin/false
2             # PODNAME: BZ::Client::XMLRPC::Array
3             # ABSTRACT: Event handler for parsing a single XML-RPC array.
4              
5 1     1   5 use strict;
  1         2  
  1         23  
6 1     1   5 use warnings 'all';
  1         1  
  1         44  
7              
8             package BZ::Client::XMLRPC::Array;
9             $BZ::Client::XMLRPC::Array::VERSION = '4.4002';
10 1     1   4 use parent qw(BZ::Client::XMLRPC::Handler);
  1         2  
  1         7  
11              
12             sub init {
13 0     0 0   my($self,$parser) = @_;
14 0           $self->SUPER::init($parser);
15 0           $self->{'result'} = []
16             }
17              
18             sub start {
19 0     0 0   my($self,$name) = @_;
20 0           my $l = $self->inc_level();
21 0 0         if ($l == 0) {
    0          
    0          
22 0 0         if ('array' ne $name) {
23 0           $self->error("Expected array element, got $name");
24             }
25             }
26             elsif ($l == 1) {
27 0 0         if ('data' ne $name) {
28 0           $self->error("Expected array/data element, got $name");
29             }
30             }
31             elsif ($l == 2) {
32 0 0         if ('value' eq $name) {
33 0           my $handler = BZ::Client::XMLRPC::Value->new();
34             $self->parser()->register($self, $handler, sub {
35 0     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             sub result {
52 0     0 0   my $self = shift;
53 0           return $self->{'result'}
54             }
55              
56             1;
57              
58             __END__
59              
60             =pod
61              
62             =encoding UTF-8
63              
64             =head1 NAME
65              
66             BZ::Client::XMLRPC::Array - Event handler for parsing a single XML-RPC array.
67              
68             =head1 VERSION
69              
70             version 4.4002
71              
72             =head1 AUTHORS
73              
74             =over 4
75              
76             =item *
77              
78             Dean Hamstead <dean@bytefoundry.com.au>
79              
80             =item *
81              
82             Jochen Wiedmann <jochen.wiedmann@gmail.com>
83              
84             =back
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2017 by Dean Hamstad.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =cut