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