Tag/unparsed.pm

filter: Statementstmt 89.8% 97 / 108 Branchbran 88.8% 32 / 36 Conditioncond 75.0% 6 / 8 MC/DCmcdc 60.0% 3 / 5 Subroutinesub 85.7% 12 / 14 Podpod 100% 11 / 11 totaltotal 88.4% 161 / 182 CC 22 SCAR 14.4
CC
22
Cov
89%
eval
12.0
new
6.0
perlprint
4.0
CRAP 4.2
↑ Summary Addon/unparsed.pm »
1 ###############################################################################
2 #unparsed.pm
3 #Last Change: 2009-01-16
4 #Copyright (c) 2009 Marc-Seabstian "Maluku" Lucksch
5 #Version 0.2
6 ####################
7 #This file is an addon to the Dotiac::DTL project.
8 #http://search.cpan.org/perldoc?Dotiac::DTL
9 #
10 #unparsed.pm is published under the terms of the MIT license, which basically
11 #means "Do with it whatever you want". For more information, see the
12 #license.txt file that should be enclosed with libsofu distributions. A copy of
13 #the license is (at the time of writing) also available at
14 #http://www.opensource.org/licenses/mit-license.php .
15 ###############################################################################
16
17
18 package Dotiac::DTL::Tag::unparsed;
19 1 ▶use base qw/Dotiac::DTL::Tag/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
22
23 1 our $VERSION=0.2;
24
25 5 ▶sub new {
Subroutine new: called CC=6 SCAR=17.9
Pod documented
26 5 my $class=shift;
27 5 my $self={p=>shift()};
28 5 my $name=shift;
29 5 my $obj=shift;
30 5 my $data=shift;
31 5 my $pos=shift;
32 5 my $found="";
33 5 ▶ my %name=Dotiac::DTL::get_variables(($name || ""),"as");
Condition100%2/2
$name || ''
l!l
32
MC/DC100%1/1
$name || ''
$name
Truth table100%2/2
A
A= $name
Aresult
11
00
34 5 ▶ $self->{filters}=[split /\|/,$name{""}->[0]] if $name{""} and $name{""}->[0];
Branch: 1 branch
BranchTrueFalseTotal
if $name{""} and $name{""}[0] 2 3 5
Condition66%2/3
$name{""} and $name{""}[0]
!ll&&!rl&&r
032
MC/DC50%1/2
$name{""} and $name{""}[0]
$name{""} $name{""}[0]
Truth table66%2/3
A and B
A= $name{""}B= $name{""}[0]
ABresult
0X0
100
111
35 5 ▶ $self->{var}=$name{"as"}->[0] if $name{"as"} and $name{"as"}->[0];
Branch: 1 branch
BranchTrueFalseTotal
if $name{"as"} and $name{"as"}[0] 2 3 5
Condition66%2/3
$name{"as"} and $name{"as"}[0]
!ll&&!rl&&r
302
MC/DC50%1/2
$name{"as"} and $name{"as"}[0]
$name{"as"} $name{"as"}[0]
Truth table66%2/3
A and B
A= $name{"as"}B= $name{"as"}[0]
ABresult
0X0
100
111
36 5 $self->{content}=$obj->unparsed($data,$pos,\$found,"unparsed","endunparsed");
37 5 bless $self,$class;
38 5 return $self;
39 }
40 5 ▶sub print {
Subroutine print: called CC=3 SCAR=11.0
Pod documented
41 5 my $self=shift;
42 5 print $self->{p};
43 5 my $vars=shift;
44 5 my $escape=shift;
45 5 my $c=$self->{content};
46 5 ▶ $c=Dotiac::DTL::apply_filters($c,$vars,0,@{$self->{filters}})->string() if $self->{filters};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"filters"} 2 3 5
47 5 ▶ if ($self->{var}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'var'}) { } 2 3 5
48 2 $vars->{$self->{var}}=$c;
49 }
50 else {
51 3 print $c;
52 }
53 5 $self->{n}->print($vars,$escape,@_);
54 }
55 5 ▶sub string {
Subroutine string: called CC=3 SCAR=11.0
Pod documented
56 5 my $self=shift;
57 5 my $vars=shift;
58 5 my $escape=shift;
59 5 my $c=$self->{content};
60 5 ▶ $c=Dotiac::DTL::apply_filters($c,$vars,0,@{$self->{filters}})->string() if $self->{filters};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"filters"} 2 3 5
61 5 ▶ if ($self->{var}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'var'}) { } 2 3 5
62 2 $vars->{$self->{var}}=$c;
63 2 return $self->{p}.$self->{n}->string($vars,$escape,@_);
64 }
65 else {
66 3 return $self->{p}.$c.$self->{n}->string($vars,$escape,@_);
67 }
68 }
69 5 ▶sub perl {
Subroutine perl: called CC=3 SCAR=11.0
Pod documented
70 5 my $self=shift;
71 5 my $fh=shift;
72 5 my $id=shift;
73 5 $self->SUPER::perl($fh,$id,@_);
74 5 print $fh "my ";
75 5 print $fh (Data::Dumper->Dump([$self->{content}],["\$content$id"]));
76 5 ▶ if ($self->{filters}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"filters"}) 2 3 5
77 2 print $fh "my ";
78 2 print $fh (Data::Dumper->Dump([$self->{filters}],["\$filters$id"]));
79 }
80 5 ▶ if ($self->{var}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"var"}) 2 3 5
81 2 print $fh "my ";
82 2 print $fh (Data::Dumper->Dump([$self->{var}],["\$var$id"]));
83 }
84 5 return $self->{n}->perl($fh,$id+1,@_)
85 }
86 5 ▶sub perlinit {
Subroutine perlinit: called CC=1 SCAR=0.0
Pod documented
87 5 my $self=shift;
88 5 my $fh=shift;
89 5 my $id=shift;
90 5 return $self->{n}->perlinit($fh,$id+1,@_)
91 }
92 5 ▶sub perlprint {
Subroutine perlprint: called CC=4 SCAR=13.9
Pod documented
93 5 my $self=shift;
94 5 my $fh=shift;
95 5 my $id=shift;
96 5 my $level=shift;
97 5 $self->SUPER::perlprint($fh,$id,$level,@_);
98 5 ▶ if ($self->{var}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'var'}) { } 2 3 5
elsif ($self->{'filters'}) { } 1 2 3
99 2 ▶ if ($self->{filters}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'filters'}) { } 1 1 2
100 1 print $fh "\t" x $level,"\$vars->{\$var$id}=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
101 }
102 else {
103 1 print $fh "\t" x $level,"\$vars->{\$var$id}=\$content$id;\n";
104 }
105 }
106 elsif ($self->{filters}) {
107 1 print $fh "\t" x $level,"print Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
108 }
109 else {
110 2 print $fh "\t" x $level,"print \$content$id;\n";
111 }
112 5 return $self->{n}->perlprint($fh,$id+1,$level,@_);
113 }
114 5 ▶sub perlstring {
Subroutine perlstring: called CC=4 SCAR=13.9
Pod documented
115 5 my $self=shift;
116 5 my $fh=shift;
117 5 my $id=shift;
118 5 my $level=shift;
119 5 $self->SUPER::perlstring($fh,$id,$level,@_);
120 5 ▶ if ($self->{var}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'var'}) { } 2 3 5
elsif ($self->{'filters'}) { } 1 2 3
121 2 ▶ if ($self->{filters}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'filters'}) { } 1 1 2
122 1 print $fh "\t" x $level,"\$vars->{\$var$id}=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
123 }
124 else {
125 1 print $fh "\t" x $level,"\$vars->{\$var$id}=\$content$id;\n";
126 }
127 }
128 elsif ($self->{filters}) {
129 1 print $fh "\t" x $level,"\$r.=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
130 }
131 else {
132 2 print $fh "\t" x $level,"\$r.=\$content$id;\n";
133 }
134 5 return $self->{n}->perlstring($fh,$id+1,$level,@_);
135 }
136 5 ▶sub perleval {
Subroutine perleval: called CC=3 SCAR=11.0
Pod documented
137 5 my $self=shift;
138 5 my $fh=shift;
139 5 my $id=shift;
140 5 my $level=shift;
141 5 ▶ if ($self->{var}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"var"}) 2 3 5
142 2 ▶ if ($self->{filters}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'filters'}) { } 1 1 2
143 1 print $fh "\t" x $level,"\$vars->{\$var$id}=Dotiac::DTL::apply_filters(\$content$id,\$vars,0,\@{\$filters$id},\@_)->string();\n";
144 }
145 else {
146 1 print $fh "\t" x $level,"\$vars->{\$var$id}=\$content$id;\n";
147 }
148 }
149 5 $self->{n}->perleval($fh,$id+1,$level,@_);
150 }
151 0 ▶sub perlcount {
Subroutine perlcount: not called CC=1 SCAR=6.9
Pod documented
152 0 my $self=shift;
153 0 my $id=shift;
154 0 return $self->{n}->perlcount($id+1);
155 }
156 5 ▶sub next {
Subroutine next: called CC=1 SCAR=0.0
Pod documented
157 5 my $self=shift;
158 5 $self->{n}=shift;
159 }
160 0 ▶sub eval {
Subroutine eval: not called CC=3 SCAR=24.8
Pod documented
161 0 my $self=shift;
162 0 my $vars=shift;
163 0 ▶ if ($self->{var}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"var"}) 0 0 0
164 0 my $c=$self->{content};
165 0 ▶ $c=Dotiac::DTL::apply_filters($c,$vars,0,@{$self->{filters}})->string() if $self->{filters};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"filters"} 0 0 0
166 0 $vars->{$self->{var}}=$c;
167 }
168 0 $self->{n}->eval($vars,@_);
169 }
170 1 1;
171
172 __END__
↑ Summary Addon/unparsed.pm »