Obj2HTML/Plugin/Base.pm

filter: Statementstmt 27.9% 12 / 43 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod n/a totaltotal 23.3% 14 / 60 SCAR 31.2
CC
6
Cov
23%
__ANON__
20.0
__ANON__
6.0
__ANON__
6.0
CRAP 22.7
« Obj2HTML/Plugin/SemanticUITabs.pm ↑ Summary
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 HTML::Obj2HTML::register_extension("repeat", {
5 tag => "",
6 before => sub {
7 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=4 SCAR=30.0
8 0 my $ret = [];
9 0 ▶ if (ref $o ne "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $o ne 'HASH') { } 0 0 0
10 0 return $o;
11 } else {
12 0 ▶ if (!defined $o->{num}) { $o->{num} = 1; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $o->{"num"}) 0 0 0
13 0 ▶ for (my $i=0; $i<$o->{num}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $o->{"num"}) 0 0 0
14 0 push(@{$ret}, @{$o->{_}});
15 }
16 }
17 0 return $ret;
18 }
19 1 });
20 HTML::Obj2HTML::register_extension("editable", {
21 tag => "",
22 before => sub {
23 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 my $prevro = HTML::Obj2HTML::get_opt("readonly");
25 0 HTML::Obj2HTML::set_opt("readonly", 0);
26 0 my $ret = HTML::Obj2HTML::gen($o);
27 0 HTML::Obj2HTML::set_opt("readonly", $prevro);
28 0 return $ret;
29 }
30 1 });
31 HTML::Obj2HTML::register_extension("readonly", {
32 tag => "",
33 before => sub {
34 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
35 0 my $prevro = HTML::Obj2HTML::get_opt("readonly");
36 0 HTML::Obj2HTML::set_opt("readonly", 1);
37 0 my $ret = HTML::Obj2HTML::gen($o);
38 0 HTML::Obj2HTML::set_opt("readonly", $prevro);
39 0 return $ret;
40 }
41 1 });
42  
43 HTML::Obj2HTML::register_extension("ifReadOnly", {
44 tag => "if",
45 before => sub {
46 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
47 0 ▶ if (ref $o eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $o eq "HASH") 0 0 0
48 0 $o->{cond} = HTML::Obj2HTML::get_opt('readonly');
49 }
50 0 return "";
51 }
52 1 });
53 HTML::Obj2HTML::register_extension("ifEditable", {
54 tag => "if",
55 before => sub {
56 0 ▶ my $o = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
57 0 ▶ if (ref $o eq "HASH") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $o eq "HASH") 0 0 0
58 0 $o->{cond} = !Obj2HTML::get_opt("readonly");
59 }
60 0 return "";
61 }
62 1 });
63  
64 1 1;
« Obj2HTML/Plugin/SemanticUITabs.pm ↑ Summary