File Coverage

blib/lib/Text/PORE/Node/Freetext.pm
Criterion Covered Total %
statement 23 26 88.4
branch 2 4 50.0
condition 2 6 33.3
subroutine 5 6 83.3
pod 0 4 0.0
total 32 46 69.5


line stmt bran cond sub pod time code
1             # Freetextnode -- unparsed HTML node
2             # text (scalar): unparsed HTML text
3             package Text::PORE::Node::Freetext;
4            
5 1     1   6 use Text::PORE::Node;
  1         2  
  1         25  
6 1     1   99 use strict;
  1         4  
  1         264  
7            
8             @Text::PORE::Node::Freetext::ISA = qw(Text::PORE::Node);
9            
10             sub new {
11 73     73 0 116 my $type = shift;
12 73         95 my $lineno = shift;
13 73         86 my $text = shift;
14            
15 73   33     438 my $self = bless {}, ref($type) || $type;
16            
17 73         361 $self = $self->SUPER::new($lineno);
18 73         197 $self->setText($text);
19            
20 73   33     507 bless $self, ref($type) || $type;
21             }
22            
23             sub setText {
24 73     73 0 91 my $self = shift;
25 73         143 my $text = shift;
26            
27 73         178 $self->{'text'} = $text;
28             }
29            
30             sub appendText {
31 0     0 0 0 my $self = shift;
32 0         0 my $text = shift;
33            
34 0         0 $self->{'text'} .= $text;
35             }
36            
37            
38             sub traverse {
39 100     100 0 115 my $self = shift;
40 100         180 my $globals = shift;
41            
42 100         122 my $return = '';
43            
44 100 50       312 $return .= "[Freetext:$self->{'lineno'}]" if $self->getDebug();
45 100 50       319 $return .= $self->{'text'} if (defined $self->{'text'});
46            
47 100         290 $self->output($return);
48            
49             # note - currently this will never have any errors in it, but if we
50             # generate errors in the future, we would want to have this
51 100         738 $self->errorDump();
52             }
53            
54             1;