line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################### |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file copyright (c) 2001-2011 Randy J. Ray, all rights reserved |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Copying and distribution are permitted under the terms of the Artistic |
6
|
|
|
|
|
|
|
# License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php) or |
7
|
|
|
|
|
|
|
# the GNU LGPL (http://www.opensource.org/licenses/lgpl-2.1.php). |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
############################################################################### |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Description: This is the RPC::XML::Parser class, an empty class that |
12
|
|
|
|
|
|
|
# acts as an interface for parser implementations that can |
13
|
|
|
|
|
|
|
# be created/returned by RPC::XML::ParserFactory. |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Functions: new |
16
|
|
|
|
|
|
|
# parse |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
# Global Consts: $VERSION |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# Environment: None. |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
############################################################################### |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
package RPC::XML::Parser; |
25
|
|
|
|
|
|
|
|
26
|
12
|
|
|
12
|
|
28499
|
use 5.008008; |
|
12
|
|
|
|
|
28
|
|
27
|
12
|
|
|
12
|
|
41
|
use strict; |
|
12
|
|
|
|
|
16
|
|
|
12
|
|
|
|
|
208
|
|
28
|
12
|
|
|
12
|
|
39
|
use warnings; |
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
333
|
|
29
|
12
|
|
|
12
|
|
39
|
use vars qw($VERSION); |
|
12
|
|
|
|
|
19
|
|
|
12
|
|
|
|
|
423
|
|
30
|
12
|
|
|
12
|
|
1018
|
use subs qw(new parse); |
|
12
|
|
|
|
|
44
|
|
|
12
|
|
|
|
|
72
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$VERSION = '1.24'; |
33
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic (ProhibitStringyEval) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
############################################################################### |
36
|
|
|
|
|
|
|
# |
37
|
|
|
|
|
|
|
# Sub Name: new |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# Description: Constructor. Dies, because this should be overridden. |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# Per RT#50013: Now, when called specifically for this class, |
42
|
|
|
|
|
|
|
# quietly loads RPC::XML::ParserFactory and instantiates a |
43
|
|
|
|
|
|
|
# parser based on XML::Parser. |
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# Returns: undef |
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
############################################################################### |
48
|
|
|
|
|
|
|
sub new |
49
|
|
|
|
|
|
|
{ |
50
|
2
|
|
|
2
|
|
320
|
my ($class, @args) = @_; |
51
|
|
|
|
|
|
|
|
52
|
2
|
100
|
|
|
|
8
|
if ($class eq 'RPC::XML::Parser') |
53
|
|
|
|
|
|
|
{ |
54
|
|
|
|
|
|
|
# For sake of not breaking backwards-compatibility with projects like |
55
|
|
|
|
|
|
|
# Catalyst::Plugin::Server::XMLRPC, in this case quietly load the |
56
|
|
|
|
|
|
|
# RPC::XML::ParserFactory and return a factory-generated instance: |
57
|
1
|
|
|
|
|
452
|
require RPC::XML::ParserFactory; |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
5
|
return RPC::XML::ParserFactory->new(class => 'xmlparser', @args); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
6
|
die __PACKAGE__ . '::new: This method should have been overridden by ' . |
63
|
|
|
|
|
|
|
"the $class class\n"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
############################################################################### |
67
|
|
|
|
|
|
|
# |
68
|
|
|
|
|
|
|
# Sub Name: parse |
69
|
|
|
|
|
|
|
# |
70
|
|
|
|
|
|
|
# Description: Parse the requested string or stream, or return a |
71
|
|
|
|
|
|
|
# push-parser instance. In this case, it dies because the |
72
|
|
|
|
|
|
|
# sub-class should have overridden it. |
73
|
|
|
|
|
|
|
# |
74
|
|
|
|
|
|
|
# Returns: dies |
75
|
|
|
|
|
|
|
# |
76
|
|
|
|
|
|
|
############################################################################### |
77
|
|
|
|
|
|
|
sub parse |
78
|
|
|
|
|
|
|
{ |
79
|
2
|
|
|
2
|
|
888
|
my $class = shift; |
80
|
2
|
|
66
|
|
|
9
|
$class = ref($class) || $class; |
81
|
|
|
|
|
|
|
|
82
|
2
|
|
|
|
|
9
|
die __PACKAGE__ . '::parse: This method should have been overridden by ' . |
83
|
|
|
|
|
|
|
"the $class class\n"; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
############################################################################### |
87
|
|
|
|
|
|
|
# |
88
|
|
|
|
|
|
|
# Sub Name: parse_more |
89
|
|
|
|
|
|
|
# |
90
|
|
|
|
|
|
|
# Description: When called on a push-parser instance (which may or may |
91
|
|
|
|
|
|
|
# not be the same class), parses additional content and |
92
|
|
|
|
|
|
|
# waits for more. In this case it dies because the sub-class |
93
|
|
|
|
|
|
|
# should have overridden it. |
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
# Returns: dies |
96
|
|
|
|
|
|
|
# |
97
|
|
|
|
|
|
|
############################################################################### |
98
|
|
|
|
|
|
|
sub parse_more |
99
|
|
|
|
|
|
|
{ |
100
|
2
|
|
|
2
|
1
|
1119
|
my $class = shift; |
101
|
2
|
|
66
|
|
|
9
|
$class = ref($class) || $class; |
102
|
|
|
|
|
|
|
|
103
|
2
|
|
|
|
|
10
|
die __PACKAGE__ . '::parse_more: This method should have been overridden' . |
104
|
|
|
|
|
|
|
" by the $class class\n"; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
############################################################################### |
108
|
|
|
|
|
|
|
# |
109
|
|
|
|
|
|
|
# Sub Name: parse_done |
110
|
|
|
|
|
|
|
# |
111
|
|
|
|
|
|
|
# Description: When called on a push-parser instance (which may or may |
112
|
|
|
|
|
|
|
# not be the same class), finishes the parse process and |
113
|
|
|
|
|
|
|
# returns the result. In this case it dies because the |
114
|
|
|
|
|
|
|
# sub-class should have overridden it. |
115
|
|
|
|
|
|
|
# |
116
|
|
|
|
|
|
|
# Returns: dies |
117
|
|
|
|
|
|
|
# |
118
|
|
|
|
|
|
|
############################################################################### |
119
|
|
|
|
|
|
|
sub parse_done |
120
|
|
|
|
|
|
|
{ |
121
|
2
|
|
|
2
|
1
|
816
|
my $class = shift; |
122
|
2
|
|
66
|
|
|
7
|
$class = ref($class) || $class; |
123
|
|
|
|
|
|
|
|
124
|
2
|
|
|
|
|
9
|
die __PACKAGE__ . '::parse_done: This method should have been overridden' . |
125
|
|
|
|
|
|
|
" by the $class class\n"; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__END__ |