| 1 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | package CGI::Application::Plugin::TT::Any; | ||||||||||||||||||||
| 5 | 2 | ▶ | BEGIN { | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 2 | $CGI::Application::Plugin::TT::Any::VERSION = '0.110080'; | |||||||||||||||||||
| 7 | } | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | # ABSTRACT: load CGI::Application::Plugin::TT with any TT-compatible class | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 2 | ▶ | use Class::Load 'load_class'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 2 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 2 | require CGI::Application::Plugin::TT; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 2 | ▶ | sub import { | ||||||||||||||||||
|
Subroutine
import: called CC=4 SCAR=13.9
| |||||||||||||||||||||
| 18 | 2 | my $pkg = shift; | |||||||||||||||||||
| 19 | 2 | my $callpkg = caller; | |||||||||||||||||||
| 20 | { | ||||||||||||||||||||
| 21 | 2 | ▶ | no warnings 'redefine'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | 2 | for (qw( tt_obj )) { | |||||||||||||||||||
| 24 | 2 | my %target = %{"$callpkg\::"}; | |||||||||||||||||||
| 25 | 2 | ▶ | die "CGI::Application::Plugin::TT needs to be loaded first" if !$target{$_}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 1 | *{"$callpkg\::$_"} = \&{$_}; | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | 1 | ▶ | return if !@_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 0 | return $callpkg->tt_config( @_ ); | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 1 | ▶ | sub tt_obj { | ||||||||||||||||||
|
Subroutine
tt_obj: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||
| 34 | 1 | my $self = shift; | |||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 1 | my ($tt, $options, $frompkg) = CGI::Application::Plugin::TT::_get_object_or_options($self); | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 1 | ▶ | return $tt if $tt; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 1 | ▶ | my $tt_options = $options->{TEMPLATE_OPTIONS} || {}; | ||||||||||||||||||
|
Condition50%1/2
$options->{'TEMPLATE_OPTIONS'} || {}
MC/DC0%0/1
$options->{'TEMPLATE_OPTIONS'} || {}
$options->{'TEMPLATE_OPTIONS'}
Truth table50%1/2
A
A= $options->{'TEMPLATE_OPTIONS'}
| |||||||||||||||||||||
| 41 | 1 | ▶ | my $class = delete $tt_options->{CLASS} || 'Template'; | ||||||||||||||||||
|
Condition50%1/2
delete $tt_options->{'CLASS'} || 'Template'
MC/DC0%0/1
delete $tt_options->{'CLASS'} || 'Template'
delete $tt_options->{'CLASS'}
Truth table50%1/2
A
A= delete $tt_options->{'CLASS'}
| |||||||||||||||||||||
| 42 | 1 | load_class $class; | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 1 | ▶ | $tt = $class->new( $tt_options ) || carp "Can't load Template"; | ||||||||||||||||||
|
Condition33%1/3
$class->new($tt_options) || carp(q[Can't load Template])
MC/DC0%0/2
$class->new($tt_options) || carp(q[Can't load Template])
$class->new($tt_options)
carp(q[Can't load Template])
Truth table33%1/3
A || B
A= $class->new($tt_options)B= carp(q[Can't load Template])
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 1 | ▶ | CGI::Application::Plugin::TT::_set_object( $frompkg||$self, $tt ); | ||||||||||||||||||
|
Condition33%1/3
$frompkg || $self
MC/DC0%0/2
$frompkg || $self
$frompkg
$self
Truth table33%1/3
A || B
A= $frompkgB= $self
| |||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 1 | return $tt; | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 2 | 1; | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||