| 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
Condition33%1/3
$@ and not $@ =~ /Can't locate \Q$filename\E\.pm/
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/
| |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | unless (%{"$arg\::"}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||