File Coverage

blib/lib/WikiText/Receiver.pm
Criterion Covered Total %
statement 9 25 36.0
branch 3 4 75.0
condition 2 3 66.6
subroutine 3 9 33.3
pod 0 7 0.0
total 17 48 35.4


line stmt bran cond sub pod time code
1 3     3   20 use strict; use warnings;
  3     3   23  
  3         107  
  3         14  
  3         6  
  3         973  
2             package WikiText::Receiver;
3              
4             sub new {
5 28     28 0 818 my $class = shift;
6 16 50       322 my $self = bless {
7             ref($class) ? (map {
8 28 100 66     404 /^(?:output)$/ ? () : ($_, $class->{$_})
9             } keys %$class) : (),
10             @_
11             }, ref($class) || $class;
12             }
13              
14             sub content {
15 0     0 0   my $self = shift;
16 0           return $self->{output};
17             }
18              
19             sub init {
20 0     0 0   my $self = shift;
21 0           die "You need to override WikiText::Receiver::init";
22             }
23              
24             sub insert {
25 0     0 0   my $self = shift;
26 0           my $ast = shift;
27 0           die "You need to override WikiText::Receiver::insert";
28             # $self->{output} .= $ast->{output};
29             }
30              
31             sub begin_node {
32 0     0 0   my $self = shift;
33 0           my $context = shift;
34 0           die "You need to override WikiText::Receiver::begin_node";
35             # $self->{output} .= "+" . $context->{type} . "\n";
36             }
37              
38             sub end_node {
39 0     0 0   my $self = shift;
40 0           my $context = shift;
41 0           die "You need to override WikiText::Receiver::end_node";
42             # $self->{output} .= "-" . $context->{type} . "\n";
43             }
44              
45             sub text_node {
46 0     0 0   my $self = shift;
47 0           my $text = shift;
48 0           die "You need to override WikiText::Receiver::text_node";
49             # $self->{output} .= " $text\n";
50             }
51              
52             1;