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