Extract.pm

filter: Statementstmt 100% 46 / 46 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 12 / 12 Podpod 80.0% 4 / 5 totaltotal 92.6% 63 / 68 SCAR 11.0
CC
3
Cov
96%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« Extract/Compile.pm ↑ Summary Extract/Parser.pm »
1 package Template::Extract;
2 1 $Template::Extract::VERSION = '0.41';
3  
4 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use constant RUN_CLASS => ( __PACKAGE__ . '::Run' );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use constant COMPILE_CLASS => ( __PACKAGE__ . '::Compile' );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use constant PARSER_CLASS => ( __PACKAGE__ . '::Parser' );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our ( $DEBUG, $EXACT );
12  
13 sub new {
14 13 ▶ my $self = shift;
Subroutine new: called CC=3 SCAR=11.0
Pod documented
15 13 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
0130
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
16  
17 13 my $run_class = $class->RUN_CLASS;
18 13 my $compile_class = $class->COMPILE_CLASS;
19 13 my $parser_class = $class->PARSER_CLASS;
20  
21 13 foreach my $subclass ( $run_class, $compile_class, $parser_class ) {
22 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 39 $class->load($subclass);
24 39 *{"$subclass\::DEBUG"} = *DEBUG;
25 39 *{"$subclass\::EXACT"} = *EXACT;
26 }
27  
28 bless(
29 {
30 13 run_object => $run_class->new(@_),
31 compile_object => $compile_class->new(@_),
32 parser_object => $parser_class->new(@_),
33 },
34 $class
35 );
36 }
37  
38 sub load {
39 39 ▶ my ( $self, $class ) = @_;
Subroutine load: called CC=1 SCAR=0.0
Pod undocumented
40 39 $class =~ s{::}{/}g;
41 39 require "$class.pm";
42 }
43  
44 sub extract {
45 12 ▶ my $self = shift;
Subroutine extract: called CC=1 SCAR=0.0
Pod documented
46 12 my $template = shift;
47  
48 12 $self->run( $self->compile($template), @_ );
49 }
50  
51 sub compile {
52 12 ▶ my $self = shift;
Subroutine compile: called CC=1 SCAR=0.0
Pod documented
53 12 my $template = shift;
54 12 $self->{compile_object}->compile( $template, $self->{parser_object} );
55 }
56  
57 sub run {
58 12 ▶ my $self = shift;
Subroutine run: called CC=1 SCAR=0.0
Pod documented
59 12 $self->{run_object}->run(@_);
60 }
61  
62 1 1;
63  
64 __END__
« Extract/Compile.pm ↑ Summary Extract/Parser.pm »