blib/lib/Spoon/Template/Mason.pm

filter: Statementstmt 100% 39 / 39 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 91.0% 51 / 56 CC 4 SCAR 5.2
CC
4
Cov
93%
_make_interp
3.0
render
2.0
BEGIN
1.0
CRAP 1.7
↑ Summary
1 package Spoon::Template::Mason;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Spoon 0.23;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Spoon::Template '-base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Cwd ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use HTML::Mason::Interp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use vars qw ($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 $VERSION = 0.05;
14  
15 2 field 'interp' =>
16 -init => '$self->_make_interp';
17  
18 sub render
19 1 ▶{
Subroutine render: called CC=2 SCAR=7.0
Pod undocumented
20 1 my $self = shift;
21 1 my $comp = shift;
22  
23 1 ▶ $comp = "/$comp" unless $comp =~ m{^/};
Branch: 1 branch
BranchTrueFalseTotal
unless $comp =~ m[^/] 1 0 1
24  
25 1 my $output = '';
26 1 $self->interp->out_method(\$output);
27 1 $self->interp->exec( $comp, $self->all, @_ );
28  
29 1 return $output;
30 }
31  
32 #method private make_interp => sub
33 sub _make_interp
34 1 ▶{
Subroutine _make_interp: called CC=3 SCAR=11.1
35 1 my $self = shift;
36 1 ▶ my $params = shift || {};
Condition50%1/2
shift() || {}
l!l
01
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
37  
38 1 my $root_name = 'root001';
39 1 my $path = $self->path;
40 1 ▶ my @roots = map { [ $root_name++ => Cwd::abs_path($_) ] } ref $path ? @$path : $path;
Branch: 1 branch
BranchTrueFalseTotal
ref $path ? : 1 0 1
41  
42 1 my $interp =
43 HTML::Mason::Interp->new
44 ( comp_root => \@roots,
45 %$params,
46 );
47  
48 1 $self->interp($interp);
49 };
50  
51  
52 2 1;
53  
54 __END__
↑ Summary