File Coverage

lib/Apache/Config/Preproc/Expand.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 6 7 85.7
pod 4 5 80.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package Apache::Config::Preproc::Expand;
2 24     24   8944 use strict;
  24         44  
  24         737  
3 24     24   117 use warnings;
  24         40  
  24         3034  
4              
5             =head1 NAME
6              
7             Apache::Config::Preproc::Expand - base class for preprocessor modules
8              
9             =head1 DESCRIPTION
10              
11             =head1 CONSTRUCTOR
12              
13             $obj = new($conf, ...)
14              
15             The only required argument to the constructor is a reference to the
16             B object which controls the preprocessing. The
17             default constructor saves this reference in the object and makes it
18             available via the B method. Rest of arguments are specific for
19             each particular expansion and are ignored by the default constructor.
20              
21             =cut
22              
23             sub new {
24 41     41 0 112 my ($class, $conf) = @_;
25 41         165 bless { _conf => $conf }, $class;
26             }
27              
28             =head1 METHODS
29              
30             =head2 conf
31              
32             Returns the B object which controls the
33             preprocessing. The module can use it in order to inspect the configuration
34             parse tree.
35              
36             =cut
37              
38 91     91 1 488 sub conf { $_[0]->{_conf} };
39              
40             =head2 begin_section
41              
42             $obj->begin_section($section);
43              
44             Invoked before running preprocessor expansions on a section. The section
45             (an instance of B or a derived class) is
46             passed as the argument.
47              
48             Default implementation is a no-op.
49              
50             =cut
51              
52       974 1   sub begin_section {}
53              
54             =head2 end_section
55              
56             $obj->end_section($section);
57              
58             Invoked when all preprocessor expansions are finished for a section. The
59             section (an instance of B or a derived class) is
60             passed as the argument.
61              
62             Default implementation is a no-op.
63              
64             =cut
65              
66       945 1   sub end_section {}
67              
68             =head2 expand
69              
70             $result = $obj->expand($node, \@items);
71              
72             Expands the configuration tree node B<$node>, places the resulting
73             nodes to B<@items> and returns true. Returns false if no expansion
74             was done on the node.
75              
76             =cut
77              
78       0 1   sub expand {}
79              
80             1;
81