File Coverage

blib/lib/BZ/Client/XMLRPC/Handler.pm
Criterion Covered Total %
statement 6 37 16.2
branch 0 8 0.0
condition 0 3 0.0
subroutine 2 11 18.1
pod 0 9 0.0
total 8 68 11.7


line stmt bran cond sub pod time code
1             #!/bin/false
2             # PODNAME: BZ::Client::XMLRPC::Handler
3             # ABSTRACT: Abstract event handler for parsing an XML-RPC response.
4 1     1   321 use strict;
  1         3  
  1         23  
5 1     1   5 use warnings 'all';
  1         1  
  1         330  
6              
7             package BZ::Client::XMLRPC::Handler;
8             $BZ::Client::XMLRPC::Handler::VERSION = '4.4002';
9             sub new {
10 0     0 0   my $class = shift;
11 0           my $self = { @_ };
12 0           $self->{'level'} = 0;
13 0   0       bless($self, ref($class) || $class);
14 0           return $self
15             }
16              
17             sub init {
18 0     0 0   my($self,$parser) = @_;
19 0           $self->parser($parser);
20             }
21              
22             sub parser {
23 0     0 0   my $self = shift;
24 0 0         if (@_) {
25 0           $self->{'parser'} = shift;
26             }
27             else {
28 0           return $self->{'parser'};
29             }
30             }
31              
32             sub level {
33 0     0 0   my $self = shift;
34 0 0         if (@_) {
35 0           $self->{'level'} = shift;
36             }
37             else {
38 0           return $self->{'level'};
39             }
40             }
41              
42             sub inc_level {
43 0     0 0   my $self = shift;
44 0           my $res = $self->{'level'}++;
45 0           return $res
46             }
47              
48             sub dec_level {
49 0     0 0   my $self = shift;
50 0           my $res = --$self->{'level'};
51 0           return $res
52             }
53              
54             sub error {
55 0     0 0   my($self, $msg) = @_;
56 0           $self->parser()->error($msg);
57             }
58              
59             sub characters {
60 0     0 0   my($self, $text) = @_;
61 0 0         if ($text !~ m/^\s*$/s) {
62 0           $self->error("Unexpected non-whitespace: $text");
63             }
64             }
65              
66             sub end {
67             # my($self,$name) = @_;
68 0     0 0   my $self = shift;
69 0           my $l = $self->dec_level();
70 0 0         if ($l == 0) {
71 0           $self->parser()->remove($self);
72             }
73 0           return $l
74             }
75              
76             1;
77              
78             __END__
79              
80             =pod
81              
82             =encoding UTF-8
83              
84             =head1 NAME
85              
86             BZ::Client::XMLRPC::Handler - Abstract event handler for parsing an XML-RPC response.
87              
88             =head1 VERSION
89              
90             version 4.4002
91              
92             =head1 AUTHORS
93              
94             =over 4
95              
96             =item *
97              
98             Dean Hamstead <dean@bytefoundry.com.au>
99              
100             =item *
101              
102             Jochen Wiedmann <jochen.wiedmann@gmail.com>
103              
104             =back
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is copyright (c) 2017 by Dean Hamstad.
109              
110             This is free software; you can redistribute it and/or modify it under
111             the same terms as the Perl 5 programming language system itself.
112              
113             =cut