blib/lib/Template/Plugin/Class.pm

filter: Statementstmt 93.7% 30 / 32 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 82.0% 41 / 50 CC 4 SCAR 8.0
CC
4
Cov
85%
new
4.4
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Template::Plugin::Class;
3 1 ▶use base 'Template::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 $VERSION = '0.14';
6  
7 1 ▶sub new {
Subroutine new: called CC=4 SCAR=14.8
Pod documented
8 1 my $class = shift;
9 1 my $context = shift;
10 1 my $arg = shift;
11  
12 # stolen from base.pm
13 1 eval "require $arg";
14 # Only ignore "Can't locate" errors from our eval require.
15 # Other fatal errors (syntax etc) must be reported.
16 1 (my $filename = $arg) =~ s!::!/!g;
17 1 ▶ die if $@ && $@ !~ /Can't locate \Q$filename\E\.pm/;
Branch: 1 branch
BranchTrueFalseTotal
if $@ and not $@ =~ /Can't locate \Q$filename\E\.pm/ 0 1 1
Condition33%1/3
$@ and not $@ =~ /Can't locate \Q$filename\E\.pm/
!ll&&!rl&&r
100
MC/DC0%0/2
$@ and not $@ =~ /Can't locate \Q$filename\E\.pm/
$@ not $@ =~ /Can't locate \Q$filename\E\.pm/
Truth table33%1/3
A and not(B)
A= $@B= not $@ =~ /Can't locate \Q$filename\E\.pm/
ABresult
0X0
100
111
18 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ unless (%{"$arg\::"}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (%{"${arg}::";}) 0 1 1
20 0 require Carp;
21 0 Carp::croak("Package \"$arg\" is empty.\n",
22 "\t(Perhaps you need to 'use' the module ",
23 "which defines that package first.)");
24 }
25  
26 1 return bless \$arg, 'Template::Plugin::Class::Proxy';
27 }
28  
29 package Template::Plugin::Class::Proxy;
30 1 ▶use vars qw( $AUTOLOAD );
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=1 SCAR=0.0
33 1 my $self = shift;
34 1 my $class = ref $self;
35 1 my ($method) = ($AUTOLOAD =~ /^$class\::(.*)/);
36 1 $$self->$method(@_);
37 }
38  
39 0 ▶sub DESTROY {}
Subroutine DESTROY: not called CC=1 SCAR=0.0
40  
41 1 1;
42 __END__
↑ Summary