| 1 | 8 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | EJS::Template::Base - Base class for some EJS::Template classes to hold common config | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | =cut | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | package EJS::Template::Base; | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 8 | ▶ | use Scalar::Util qw(reftype); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | =head1 Methods | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | =head2 new | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | Common constructor with the config | ||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | =cut | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 274 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 24 | 274 | my ($class, $config) = @_; | |||||||||||||||||||
| 25 | 274 | ▶ | $config = {} unless ref $config; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 274 | $config = {map {$_ => $config->{$_}} @EJS::Template::CONFIG_KEYS}; | |||||||||||||||||||
| 27 | 274 | return bless {config => $config}, $class; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | =head2 config | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | Retrieves the config value. | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | =cut | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 166 | ▶ | sub config { | ||||||||||||||||||
|
Subroutine
config: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||
| 37 | 166 | my $self = shift; | |||||||||||||||||||
| 38 | 166 | my $config = $self->{config}; | |||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 166 | for my $name (@_) { | |||||||||||||||||||
| 41 | 83 | ▶ | if ((reftype($config) || '') eq 'HASH') { | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::reftype($config) || ''
MC/DC0%0/1
builtin::reftype($config) || ''
builtin::reftype($config)
Truth table50%1/2
A
A= builtin::reftype($config)
| |||||||||||||||||||||
| 42 | 83 | $config = $config->{$name}; | |||||||||||||||||||
| 43 | } else { | ||||||||||||||||||||
| 44 | 0 | return undef; | |||||||||||||||||||
| 45 | } | ||||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 166 | return $config; | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | =head1 SEE ALSO | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | =over 4 | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | =item * L<EJS::Template> | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | =back | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | =cut | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 8 | 1; | |||||||||||||||||||