Template/Base.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 87.1% 34 / 39 CC 5 SCAR 9.3
CC
5
Cov
87%
config
4.3
new
2.0
BEGIN
1.0
CRAP 2.5
« Template.pm ↑ Summary Template/Executor.pm »
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
BranchTrueFalseTotal
unless ref $config 0 274 274
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
BranchTrueFalseTotal
if ((builtin::reftype($config) || '') eq 'HASH') { } 83 0 83
Condition50%1/2
builtin::reftype($config) || ''
l!l
830
MC/DC0%0/1
builtin::reftype($config) || ''
builtin::reftype($config)
Truth table50%1/2
A
A= builtin::reftype($config)
Aresult
11
00
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;
« Template.pm ↑ Summary Template/Executor.pm »