Auto/Templates.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 96.8% 31 / 32 CC 2 SCAR 2.5
CC
2
Cov
96%
_template_content
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Auto.pm ↑ Summary
1 package HTML::Auto::Templates;
2 # ABSTRACT: stores HTML::Auto templates
3 3 $HTML::Auto::Templates::VERSION = '0.09';
4 3 ▶use base qw/Template::Provider/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 my $templates = {
12  
13 'matrix' => <<'EOT'
14 <style type="text/css">
15 span.vertical {
16 -webkit-transform: rotate(180deg);
17 -moz-transform: rotate(180deg);
18 transform: rotate(180deg);
19 writing-mode: tb-rl;
20 filter: flipv fliph;
21 display: block;
22 width: 20px;
23 white-space: nowrap;
24 }
25  
26 table.auto th {
27 padding-top: 24px;
28 padding-bottom: 10px;
29 padding-left: 5px;
30 padding-right: 5px;
31 width: 20px;
32 background-color: #aaaaaa;
33 }
34  
35 table.auto td {
36 text-align: center;
37 width: 30px;
38 background-color: #eeeeee;
39 padding: 6px;
40 }
41  
42 table.auto td.fst {
43 width: 80px;
44 font-weight: bold;
45 background-color: #aaaaaa;
46 padding: 5px;
47 }
48  
49 th.empty {
50 background-color: white !important;
51 }
52  
53 table.auto td.mid {
54 background-color: #cccccc;
55 }
56  
57 td:hover {
58 background-color: #aaaaaa;
59 }
60  
61 td.more_info {
62 position:relative;
63 z-index:24;
64 text-decoration:none;
65 cursor: default;
66 color: black;
67 width: 80px;
68 }
69  
70 td.more_info:hover{
71 z-index:25;
72 }
73  
74 td.more_info td {
75 width: auto;
76 }
77  
78 td.more_info span {
79 display: none;
80 }
81  
82 td.more_info:hover span {
83 display:block;
84 position:absolute;
85 border:1px solid #ccc;
86 min-width:24em;
87 background-color:#fff;
88 color:#000;
89 text-align: left;
90 font-size: 80%;
91 text-decoration: none;
92 }
93  
94 [% IF css %]
95 [% css %]
96 [% END %]
97 </style>
98  
99 <table class="auto">
100 <tr>
101 <th class="empty"> </th>
102 [% FOREACH i IN cols %]
103 <th> <span class="vertical">[% i -%]</span></th>
104 [% END %]
105 </tr>
106 [% i_c = 0 %]
107 [% FOREACH i IN vals %]
108 <tr>
109 <td class="fst">[% lines.shift -%]</td>
110 [% j_c = 0 %]
111 [% FOREACH j IN i %]
112 <td
113 [% class = "" %]
114 [% IF diagonal AND i_c == j_c %]
115 [% class = "mid" %]
116 [% END %]
117 [% IF more.$i_c.$j_c %]
118 [% class = "more_info " _ class %]
119 [% END %]
120 [% IF attrs.$i_c.$j_c.class %]
121 [% class = class _ " " _ attrs.$i_c.$j_c.class %]
122 [% END %]
123 [% attrs.$i_c.$j_c.delete('class') %]
124 [% IF class.length != 0 %] class="[% class %]" [% END %]
125 [% FOREACH att IN attrs.$i_c.$j_c.keys %]
126 [% att %]="[% attrs.$i_c.$j_c.$att %]"
127 [% END %]
128 >[% IF myformat %][% j | format(myformat) %][% ELSE %][% j %][% END %]
129 [% IF more.$i_c.$j_c %]
130 <span>[% more.$i_c.$j_c %]</span>
131 [% END %]
132 </td>
133 [% j_c = j_c + 1 %]
134 [% END %]
135 </tr>
136 [% i_c = i_c + 1 %]
137 [% END %]
138 </table>
139 EOT
140 ,
141 'h' => <<'EOT'
142 <div>
143 [% FOREACH i IN list %]
144 <div style="float: left;">[% i %]</div>
145 [% END %]
146 <span style="clear: both;"></div>
147 </div>
148 EOT
149 ,
150 'v' => <<'EOT'
151 [% FOREACH i IN list %]
152 <div>[% i %]</div>
153 [% END %]
154 EOT
155 };
156  
157 15 ▶sub _template_modified {
Subroutine _template_modified: called CC=1 SCAR=0.0
158 15 my($self,$path) = @_;
159  
160 15 return 1;
161 }
162  
163 5 ▶sub _template_content {
Subroutine _template_content: called CC=2 SCAR=7.0
164 5 my ($self, $path) = @_;
165  
166 5 $path = basename($path);;
167 5 ▶ $self->debug("get $path") if $self->{DEBUG};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"DEBUG"} 0 5 5
168  
169 5 my $data = $templates->{$path};
170 5 my $error = "error: $path not found";
171 5 my $mod_date = 1;
172  
173 5 return $data;
174 }
175  
176 3 1;
177  
178 __END__
« Auto.pm ↑ Summary