blib/lib/HTML/Template/Pro/WrapAssociate.pm

filter: Statementstmt 40.4% 17 / 42 Branchbran 25.0% 2 / 8 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 28.5% 4 / 14 Podpod 0.0% 0 / 1 totaltotal 32.0% 24 / 75 SCAR 34.2
CC
9
Cov
36%
_wrap
31.8
param
2.0
TIEHASH
2.0
CRAP 30.5
« blib/lib/HTML/Template/Pro.pm ↑ Summary callback_stubs.inc »
1 package HTML::Template::Pro::WrapAssociate;
2  
3 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use vars qw($VERSION @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub _wrap {
8 1 ▶ my ($class, $associate_object, $is_case_sensitive, $is_strict_compatibility) = @_;
Subroutine _wrap: called CC=9 SCAR=34.6
9 1 ▶ if (ref($associate_object) && UNIVERSAL::can($associate_object,'param')) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $associate_object and UNIVERSAL::can($associate_object, 'param')) { } 1 0 1
elsif (not $is_strict_compatibility and UNIVERSAL::isa($associate_object, 'HASH')) { } 0 0 0
Condition33%1/3
ref $associate_object and UNIVERSAL::can($associate_object, "param")
!ll&&!rl&&r
001
MC/DC0%0/2
ref $associate_object and UNIVERSAL::can($associate_object, "param")
ref $associate_object UNIVERSAL::can($associate_object, "param")
Truth table33%1/3
A and B
A= ref $associate_objectB= UNIVERSAL::can($associate_object, "param")
ABresult
0X0
100
111
10 1 my %hash;
11 1 ▶ if ($is_case_sensitive) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_case_sensitive) { } 0 1 1
12 0 tie %hash, $class, $associate_object;
13 } else {
14 1 foreach my $key ($associate_object->param()) {
15 1 $hash{lc($key)} = $associate_object->param($key);
16 }
17 }
18 1 return \%hash;
19 ▶ } elsif (!$is_strict_compatibility && UNIVERSAL::isa($associate_object,'HASH')) {
Condition0%0/3
not $is_strict_compatibility and UNIVERSAL::isa($associate_object, "HASH")
!ll&&!rl&&r
000
MC/DC0%0/2
not $is_strict_compatibility and UNIVERSAL::isa($associate_object, "HASH")
not $is_strict_compatibility UNIVERSAL::isa($associate_object, "HASH")
Truth table0%0/3
not(A) and B
A= not $is_strict_compatibilityB= UNIVERSAL::isa($associate_object, "HASH")
ABresult
0X0
100
111
20 0 ▶ if ($is_case_sensitive) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_case_sensitive) { } 0 0 0
21 0 return $associate_object;
22 } else {
23 0 my %hash;
24 0 foreach my $key (keys(%$associate_object)) {
25 0 $hash{lc($key)} = $associate_object->{$key};
26 }
27 0 return \%hash;
28 }
29 } else {
30 0 Carp::croak "bad value for associate: HTML::Template::Pro->new called with associate option, containing object of type " . ref($associate_object) . " which lacks a param() method and does not look like a hash!";
31 }
32 }
33  
34 sub param {
35 0 ▶ my $this = shift;
Subroutine param: not called CC=1 SCAR=6.9
Pod undocumented
36 0 return $this->[0]->param(@_);
37 }
38  
39 sub TIEHASH {
40 0 ▶ my ($class, $associate) = @_;
Subroutine TIEHASH: not called CC=1 SCAR=6.9
41 0 my $self=[$associate,[]];
42 0 return bless $self, $class;
43 };
44  
45 sub FETCH {
46 0 ▶ my ($this, $key) = @_;
Subroutine FETCH: not called CC=1 SCAR=6.9
47 0 return $this->[0]->param($key);
48 }
49  
50 sub EXISTS {
51 0 ▶ my ($this, $key) = @_;
Subroutine EXISTS: not called CC=1 SCAR=6.9
52 0 return defined($this->[0]->param($key));
53 }
54  
55 sub FIRSTKEY{
56 0 ▶ my ($this) = @_;
Subroutine FIRSTKEY: not called CC=1 SCAR=6.9
57 0 my @param=$this->[0]->param();
58 0 $this->[1]=\@param;
59 0 return shift @{$this->[1]};
60 }
61  
62 sub NEXTKEY{
63 0 ▶ my ($this) = @_;
Subroutine NEXTKEY: not called CC=1 SCAR=6.9
64 0 return shift @{$this->[1]};
65 }
66  
67 ▶sub STORE{}
Subroutine STORE: not called CC=1 SCAR=0.0
68 ▶sub DELETE{}
Subroutine DELETE: not called CC=1 SCAR=0.0
69 ▶sub CLEAR{}
Subroutine CLEAR: not called CC=1 SCAR=0.0
70 ▶sub SCALAR{}
Subroutine SCALAR: not called CC=1 SCAR=0.0
71  
72 14 1;
73  
74 __END__
« blib/lib/HTML/Template/Pro.pm ↑ Summary callback_stubs.inc »