Simple/Compiler/Safe.pm

filter: Statementstmt 75.8% 22 / 29 Branchbran 20.0% 2 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 60.7% 31 / 51 CC 7 SCAR 23.1
CC
7
Cov
57%
_object
18.8
_permit
2.0
BEGIN
1.0
CRAP 10.1
« Simple/IO.pm ↑ Summary Simple.pm »
1 package Text::Template::Simple::Compiler::Safe;
2 32 $Text::Template::Simple::Compiler::Safe::VERSION = '0.91';
3 # Safe compiler. Totally experimental
4 32 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 32 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 32 ▶use Text::Template::Simple::Dummy;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶sub compile {
Subroutine compile: called CC=1 SCAR=0.0
Pod documented
10 1 shift;
11 1 return __PACKAGE__->_object->reval(shift);
12 }
13  
14 1 ▶sub _object {
Subroutine _object: called CC=6 SCAR=29.3
15 1 my $class = shift;
16 1 ▶ if ( $class->can('object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->can("object")) 0 1 1
17 0 my $safe = $class->object;
18 0 ▶ if ( $safe && ref $safe ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($safe and ref $safe) 0 0 0
Condition0%0/3
$safe and ref $safe
!ll&&!rl&&r
000
MC/DC0%0/2
$safe and ref $safe
$safe ref $safe
Truth table0%0/3
A and B
A= $safeB= ref $safe
ABresult
0X0
100
111
19 0 ▶ return $safe if eval { $safe->isa('Safe'); 'Safe-is-OK' };
Branch: 1 branch
BranchTrueFalseTotal
if eval { do { $safe->isa("Safe"); "Safe-is-OK" } } 0 0 0
20 }
21 0 ▶ my $end = $@ ? q{: }.$@ : q{.};
Branch: 1 branch
BranchTrueFalseTotal
$@ ? : 0 0 0
22 0 warn 'Safe object failed. Falling back to default' . $end . "\n";
23 }
24 1 require Safe;
25 1 my $safe = Safe->new('Text::Template::Simple::Dummy');
26 1 $safe->permit( $class->_permit );
27 1 return $safe;
28 }
29  
30 1 ▶sub _permit {
Subroutine _permit: called CC=2 SCAR=7.1
31 1 my $class = shift;
32 1 ▶ return $class->permit if $class->can('permit');
Branch: 1 branch
BranchTrueFalseTotal
if $class->can("permit") 0 1 1
33 1 return qw( :default require caller );
34 }
35  
36 32 1;
37  
38 __END__
« Simple/IO.pm ↑ Summary Simple.pm »