CheckPad/Parser.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 35 CC 3 SCAR 16.7
CC
3
Cov
0%
param
12.0
new
2.0
convert_to_item
2.0
CRAP 5.3
1 package WWW::CheckPad::Parser;
2  
3 use strict;
4 use warnings;
5 use HTML::Parser;
6 use base qw(HTML::Parser);
7  
8 sub new {
9 my $class = shift;
10 my $self = new HTML::Parser();
11 return bless $self, $class;
12 }
13  
14  
15 sub convert_to_item {
16 my ($self, $content, @args) = @_;
17 return $self->_parse($content, @args);
18 }
19  
20  
21 ############################################################
22 # Usage: YourParser->param(<key>[, <value>])
23 # Returns: The value related to <key>.
24 #
25 # If you need to save any values during parsing the string.
26 # You can use this method to save it.
27 ############################################################
28 sub param {
29 my ($self, $key, $value) = @_;
30  
31 $self->{_CP_PARSER} = {} if not defined $self->{_CP_PARSER};
32 $self->{_CP_PARSER}->{$key} = $value if defined $value;
33  
34 return $self->{_CP_PARSER}->{$key};
35 }
36  
37  
38 1;