blib/lib/HTML/CalendarMonthSimple/MultiDaysEvent.pm

filter: Statementstmt 90.4% 208 / 230 Branchbran 51.5% 68 / 132 Conditioncond 38.3% 66 / 172 MC/DCmcdc 5.3% 6 / 112 Subroutinesub 100% 5 / 5 Podpod 33.3% 1 / 3 totaltotal 54.1% 354 / 654 CC 139 SCAR 69.9
CC
139
Cov
64%
multidays_HTML
1128.7
add_event
2.0
new
2.0
CRAP 1081.4
↑ Summary
1 package HTML::CalendarMonthSimple::MultiDaysEvent;
2  
3 1 our $VERSION = '0.03';
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base 'HTML::CalendarMonthSimple';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
9 1 my $class = shift;
10 1 my $self = $class->SUPER::new;;
11 1 bless $self,$class;
12 1 $self->{events}->{$_} = [] for (1..31);
13 1 return $self;
14 }
15  
16 1 ▶sub multidays_HTML {
Subroutine multidays_HTML: called CC=137 SCAR=70.3
Pod undocumented
17 1 my $self = shift;
18 1 my %params = @_;
19 1 my $html = '';
20 1 my(@days,$weeks,$WEEK,$DAY);
21  
22 # To make the grid even, pad the start of the series with 0s
23 1 @days = (1 .. Date::Calc::Days_in_Month($self->year(),$self->month() ) );
24 1 ▶ if ($self->weekstartsonmonday()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->weekstartsonmonday) { } 0 1 1
25 0 foreach (1 .. (Date::Calc::Day_of_Week($self->year(),
26 $self->month(),1) -1 )) {
27 0 unshift(@days,0);
28 }
29 }
30 else {
31 1 foreach (1 .. (Date::Calc::Day_of_Week($self->year(),
32 $self->month(),1)%7) ) {
33 0 unshift(@days,0);
34 }
35 }
36 1 $weeks = int((scalar(@days)+6)/7);
37 # And pad the end as well, to avoid "uninitialized value" warnings
38 1 foreach (scalar(@days)+1 .. $weeks*7) {
39 5 push(@days,0);
40 }
41  
42 # Define some scalars for generating the table
43 1 my $border = $self->border();
44 1 my $tablewidth = $self->width();
45 1 ▶ $tablewidth =~ m/^(\d+)(\%?)$/; my $cellwidth = (int($1/7))||'14'; if ($2) { $cellwidth .= '%'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($2) 1 0 1
Condition50%1/2
int $1 / 7 || '14'
l!l
10
MC/DC0%0/1
int $1 / 7 || '14'
int $1 / 7
Truth table50%1/2
A
A= int $1 / 7
Aresult
11
00
46 1 my $header = $self->header();
47 1 my $cellalignment = $self->cellalignment();
48 1 my $vcellalignment = $self->vcellalignment();
49 1 my $contentfontsize = $self->contentfontsize();
50 1 my $bgcolor = $self->bgcolor();
51 1 ▶ my $weekdaycolor = $self->weekdaycolor() || $self->bgcolor();
Condition33%1/3
$self->weekdaycolor || $self->bgcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekdaycolor || $self->bgcolor
$self->weekdaycolor $self->bgcolor
Truth table33%1/3
A || B
A= $self->weekdaycolorB= $self->bgcolor
ABresult
1X1
011
000
52 1 ▶ my $weekendcolor = $self->weekendcolor() || $self->bgcolor();
Condition33%1/3
$self->weekendcolor || $self->bgcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekendcolor || $self->bgcolor
$self->weekendcolor $self->bgcolor
Truth table33%1/3
A || B
A= $self->weekendcolorB= $self->bgcolor
ABresult
1X1
011
000
53 1 ▶ my $todaycolor = $self->todaycolor() || $self->bgcolor();
Condition33%1/3
$self->todaycolor || $self->bgcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->todaycolor || $self->bgcolor
$self->todaycolor $self->bgcolor
Truth table33%1/3
A || B
A= $self->todaycolorB= $self->bgcolor
ABresult
1X1
011
000
54 1 ▶ my $contentcolor = $self->contentcolor() || $self->contentcolor();
Condition33%1/3
$self->contentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->contentcolor || $self->contentcolor
$self->contentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->contentcolorB= $self->contentcolor
ABresult
1X1
011
000
55 1 ▶ my $weekdaycontentcolor = $self->weekdaycontentcolor() || $self->contentcolor();
Condition33%1/3
$self->weekdaycontentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekdaycontentcolor || $self->contentcolor
$self->weekdaycontentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->weekdaycontentcolorB= $self->contentcolor
ABresult
1X1
011
000
56 1 ▶ my $weekendcontentcolor = $self->weekendcontentcolor() || $self->contentcolor();
Condition33%1/3
$self->weekendcontentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekendcontentcolor || $self->contentcolor
$self->weekendcontentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->weekendcontentcolorB= $self->contentcolor
ABresult
1X1
011
000
57 1 ▶ my $todaycontentcolor = $self->todaycontentcolor() || $self->contentcolor();
Condition33%1/3
$self->todaycontentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->todaycontentcolor || $self->contentcolor
$self->todaycontentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->todaycontentcolorB= $self->contentcolor
ABresult
1X1
011
000
58 1 ▶ my $bordercolor = $self->bordercolor() || $self->bordercolor();
Condition33%1/3
$self->bordercolor || $self->bordercolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->bordercolor || $self->bordercolor
$self->bordercolor $self->bordercolor
Truth table33%1/3
A || B
A= $self->bordercolorB= $self->bordercolor
ABresult
1X1
011
000
59 1 ▶ my $weekdaybordercolor = $self->weekdaybordercolor() || $self->bordercolor();
Condition33%1/3
$self->weekdaybordercolor || $self->bordercolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekdaybordercolor || $self->bordercolor
$self->weekdaybordercolor $self->bordercolor
Truth table33%1/3
A || B
A= $self->weekdaybordercolorB= $self->bordercolor
ABresult
1X1
011
000
60 1 ▶ my $weekendbordercolor = $self->weekendbordercolor() || $self->bordercolor();
Condition33%1/3
$self->weekendbordercolor || $self->bordercolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekendbordercolor || $self->bordercolor
$self->weekendbordercolor $self->bordercolor
Truth table33%1/3
A || B
A= $self->weekendbordercolorB= $self->bordercolor
ABresult
1X1
011
000
61 1 ▶ my $todaybordercolor = $self->todaybordercolor() || $self->bordercolor();
Condition33%1/3
$self->todaybordercolor || $self->bordercolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->todaybordercolor || $self->bordercolor
$self->todaybordercolor $self->bordercolor
Truth table33%1/3
A || B
A= $self->todaybordercolorB= $self->bordercolor
ABresult
1X1
011
000
62 1 ▶ my $weekdayheadercolor = $self->weekdayheadercolor() || $self->bgcolor();
Condition33%1/3
$self->weekdayheadercolor || $self->bgcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekdayheadercolor || $self->bgcolor
$self->weekdayheadercolor $self->bgcolor
Truth table33%1/3
A || B
A= $self->weekdayheadercolorB= $self->bgcolor
ABresult
1X1
011
000
63 1 ▶ my $weekendheadercolor = $self->weekendheadercolor() || $self->bgcolor();
Condition33%1/3
$self->weekendheadercolor || $self->bgcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekendheadercolor || $self->bgcolor
$self->weekendheadercolor $self->bgcolor
Truth table33%1/3
A || B
A= $self->weekendheadercolorB= $self->bgcolor
ABresult
1X1
011
000
64 1 ▶ my $headercontentcolor = $self->headercontentcolor() || $self->contentcolor();
Condition33%1/3
$self->headercontentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->headercontentcolor || $self->contentcolor
$self->headercontentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->headercontentcolorB= $self->contentcolor
ABresult
1X1
011
000
65 1 ▶ my $weekdayheadercontentcolor = $self->weekdayheadercontentcolor() || $self->contentcolor();
Condition33%1/3
$self->weekdayheadercontentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekdayheadercontentcolor || $self->contentcolor
$self->weekdayheadercontentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->weekdayheadercontentcolorB= $self->contentcolor
ABresult
1X1
011
000
66 1 ▶ my $weekendheadercontentcolor = $self->weekendheadercontentcolor() || $self->contentcolor();
Condition33%1/3
$self->weekendheadercontentcolor || $self->contentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekendheadercontentcolor || $self->contentcolor
$self->weekendheadercontentcolor $self->contentcolor
Truth table33%1/3
A || B
A= $self->weekendheadercontentcolorB= $self->contentcolor
ABresult
1X1
011
000
67 1 ▶ my $headercolor = $self->headercolor() || $self->bgcolor();
Condition33%1/3
$self->headercolor || $self->bgcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->headercolor || $self->bgcolor
$self->headercolor $self->bgcolor
Truth table33%1/3
A || B
A= $self->headercolorB= $self->bgcolor
ABresult
1X1
011
000
68 1 my $cellpadding = $self->cellpadding();
69 1 my $cellspacing = $self->cellspacing();
70 1 my $sharpborders = $self->sharpborders();
71 1 my $cellheight = $self->cellheight();
72 1 my $cellclass = $self->cellclass();
73 1 my $tableclass = $self->tableclass();
74 1 ▶ my $weekdaycellclass = $self->weekdaycellclass() || $self->cellclass();
Condition33%1/3
$self->weekdaycellclass || $self->cellclass
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekdaycellclass || $self->cellclass
$self->weekdaycellclass $self->cellclass
Truth table33%1/3
A || B
A= $self->weekdaycellclassB= $self->cellclass
ABresult
1X1
011
000
75 1 ▶ my $weekendcellclass = $self->weekendcellclass() || $self->cellclass();
Condition33%1/3
$self->weekendcellclass || $self->cellclass
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->weekendcellclass || $self->cellclass
$self->weekendcellclass $self->cellclass
Truth table33%1/3
A || B
A= $self->weekendcellclassB= $self->cellclass
ABresult
1X1
011
000
76 1 ▶ my $todaycellclass = $self->todaycellclass() || $self->cellclass();
Condition33%1/3
$self->todaycellclass || $self->cellclass
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->todaycellclass || $self->cellclass
$self->todaycellclass $self->cellclass
Truth table33%1/3
A || B
A= $self->todaycellclassB= $self->cellclass
ABresult
1X1
011
000
77 1 ▶ my $headerclass = $self->headerclass() || $self->cellclass();
Condition33%1/3
$self->headerclass || $self->cellclass
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->headerclass || $self->cellclass
$self->headerclass $self->cellclass
Truth table33%1/3
A || B
A= $self->headerclassB= $self->cellclass
ABresult
1X1
011
000
78 1 my $nowrap = $self->nowrap();
79  
80 # Get today's date, in case there's a todaycolor()
81 1 my($todayyear,$todaymonth,$todaydate) = ($self->today_year(),$self->today_month(),$self->today_date());
82  
83 # the table declaration - sharpborders wraps the table inside a table cell
84 1 ▶ if ($sharpborders) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sharpborders) { } 0 1 1
85 0 $html .= "<table border=\"0\"";
86 0 ▶ $html .= " class=\"$tableclass\"" if defined $tableclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tableclass 0 0 0
87 0 ▶ $html .= " width=\"$tablewidth\"" if defined $tablewidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tablewidth 0 0 0
88 0 $html .= " cellpadding=\"0\" cellspacing=\"0\">\n";
89 0 $html .= "<tr valign=\"top\" align=\"left\">\n";
90 0 $html .= "<td align=\"left\" valign=\"top\"";
91 0 ▶ $html .= " bgcolor=\"$bordercolor\"" if defined $bordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $bordercolor 0 0 0
92 0 $html .= ">";
93 0 $html .= "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\">";
94 }
95 else {
96 1 $html .= "<table";
97 1 ▶ $html .= " class=\"$tableclass\"" if defined $tableclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tableclass 0 1 1
98 1 ▶ $html .= " border=\"$border\"" if defined $border;
Branch: 1 branch
BranchTrueFalseTotal
if defined $border 1 0 1
99 1 ▶ $html .= " width=\"$tablewidth\"" if defined $tablewidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tablewidth 1 0 1
100 1 ▶ $html .= " bgcolor=\"$bgcolor\"" if defined $bgcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $bgcolor 0 1 1
101 1 ▶ $html .= " bordercolor=\"$bordercolor\"" if defined $bordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $bordercolor 0 1 1
102 1 ▶ $html .= " cellpadding=\"$cellpadding\"" if defined $cellpadding;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellpadding 0 1 1
103 1 ▶ $html .= " cellspacing=\"$cellspacing\"" if defined $cellspacing;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellspacing 0 1 1
104 1 $html .= ">\n";
105 }
106 # the header
107 1 ▶ if ($header) {
Branch: 1 branch
BranchTrueFalseTotal
if ($header) 1 0 1
108 1 $html .= "<tr><td colspan=\"7\"";
109 1 ▶ $html .= " bgcolor=\"$headercolor\"" if defined $headercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercolor 0 1 1
110 1 ▶ $html .= " class=\"$headerclass\"" if defined $headerclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headerclass 0 1 1
111 1 $html .= ">";
112 1 ▶ $html .= "<font color=\"$headercontentcolor\">" if defined $headercontentcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercontentcolor 0 1 1
113 1 $html .= $header;
114 1 ▶ $html .= "</font>" if defined $headercontentcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercontentcolor 0 1 1
115 1 $html .= "</td></tr>\n";
116 }
117 # the names of the days of the week
118 1 ▶ if ($self->showweekdayheaders) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->showweekdayheaders) 1 0 1
119 1 ▶ my $celltype = $self->weekdayheadersbig() ? "th" : "td";
Branch: 1 branch
BranchTrueFalseTotal
$self->weekdayheadersbig ? : 1 0 1
120 1 my @weekdays = $self->weekdays();
121  
122 1 ▶ my $saturday_html = "<$celltype"
Branch: 4 branches
BranchTrueFalseTotal
defined $weekendheadercolor ? : 0 1 1
defined $weekendcellclass ? : 0 1 1
defined $weekendheadercontentcolor ? : 0 1 1
defined $weekendheadercontentcolor ? : 0 1 1
123 . ( defined $weekendheadercolor
124 ? qq| bgcolor="$weekendheadercolor"|
125 : '' )
126 . ( defined $weekendcellclass
127 ? qq| class="$weekendcellclass"|
128 : '' )
129 . ">"
130 . ( defined $weekendheadercontentcolor
131 ? qq|<font color="$weekendheadercontentcolor">|
132 : '' )
133 . $self->saturday()
134 . ( defined $weekendheadercontentcolor
135 ? qq|</font>|
136 : '' )
137 . "</$celltype>\n";
138  
139 1 ▶ my $sunday_html = "<$celltype"
Branch: 4 branches
BranchTrueFalseTotal
defined $weekendheadercolor ? : 0 1 1
defined $weekendcellclass ? : 0 1 1
defined $weekendheadercontentcolor ? : 0 1 1
defined $weekendheadercontentcolor ? : 0 1 1
140 . ( defined $weekendheadercolor
141 ? qq| bgcolor="$weekendheadercolor"|
142 : '' )
143 . ( defined $weekendcellclass
144 ? qq| class="$weekendcellclass"|
145 : '' )
146 . ">"
147 . ( defined $weekendheadercontentcolor
148 ? qq|<font color="$weekendheadercontentcolor">|
149 : '' )
150 . $self->sunday()
151 . ( defined $weekendheadercontentcolor
152 ? qq|</font>|
153 : '' )
154 . "</$celltype>\n";
155
156 1 my $weekday_html = '';
157 1 foreach (@weekdays) { # draw the weekday headers
158  
159 5 ▶ $weekday_html .= "<$celltype"
Branch: 4 branches
BranchTrueFalseTotal
defined $weekendheadercolor ? : 0 5 5
defined $weekendcellclass ? : 0 5 5
defined $weekdayheadercontentcolor ? : 0 5 5
defined $weekdayheadercontentcolor ? : 0 5 5
160 . ( defined $weekendheadercolor
161 ? qq| bgcolor="$weekdayheadercolor"|
162 : '' )
163 . ( defined $weekendcellclass
164 ? qq| class="$weekdaycellclass"|
165 : '' )
166 . ">"
167 . ( defined $weekdayheadercontentcolor
168 ? qq|<font color="$weekdayheadercontentcolor">|
169 : '' )
170 . $_
171 . ( defined $weekdayheadercontentcolor
172 ? qq|</font>|
173 : '' )
174 . "</$celltype>\n";
175 }
176  
177 1 $html .= "<tr>\n";
178 1 ▶ if ($self->weekstartsonmonday()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->weekstartsonmonday) { } 0 1 1
179 0 $html .= $weekday_html
180 . $saturday_html
181 . $sunday_html;
182 }
183 else {
184 1 $html .= $sunday_html
185 . $weekday_html
186 . $saturday_html;
187 }
188 1 $html .= "</tr>\n";
189 }
190  
191 1 my $_saturday_index = 6;
192 1 my $_sunday_index = 0;
193 1 ▶ if ($self->weekstartsonmonday()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->weekstartsonmonday) 0 1 1
194 0 $_saturday_index = 5;
195 0 $_sunday_index = 6;
196 }
197 # now do each day, the actual date-content-containing cells
198 1 foreach $WEEK (0 .. ($weeks-1)) {
199 5 my $weekevents = 0;
200 5 my %prerow;
201 my %daycol;
202 5 my $firstday = $days[(7*$WEEK)];
203 5 my $lastday = $firstday + 6;
204 5 my $firstevent;
205  
206 5 for $DAY (0 .. 6) {
207 35 my $thisday = $days[((7*$WEEK)+$DAY)];
208 35 ▶ if ($#{$self->{events}->{$thisday}} > -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$$self{"events"}{$thisday};} > -1) 1 34 35
209 1 ▶ $firstevent = $thisday unless ($firstevent);
Branch: 1 branch
BranchTrueFalseTotal
unless $firstevent 1 0 1
210 1 $weekevents += scalar(@{$self->{events}->{$thisday}});
211 0 for my $event (sort { $a->{length} <=> $b->{length} } (@{$self->{events}->{$thisday}})) {
212 1 for (0 .. $event->{length} - 1) {
213 3 ▶ $prerow{$thisday+$_} = $weekevents unless ($prerow{$thisday+$_});
Branch: 1 branch
BranchTrueFalseTotal
unless $prerow{$thisday + $_} 3 0 3
214 }
215 1 ▶ if ($thisday + ($event->{length} - 1) > $lastday) {
Branch: 1 branch
BranchTrueFalseTotal
if ($thisday + ($event->{"length"} - 1) > $lastday) 0 1 1
216 $self->add_event( date => $lastday+1,
217 event => $event->{event},
218 length => $event->{length} -
219 0 ($lastday - $thisday + 1) );
220 0 $event->{length} = $lastday-$thisday+1;
221 }
222 }
223 }
224 }
225 5 $html .= "<tr style=\"line-height:4em;\">\n";
226 5 foreach $DAY ( 0 .. 6 ) {
227 35 my($thiscontent,$thisday,$thisbgcolor,$thisbordercolor,$thiscontentcolor,$thiscellclass);
228 35 $thisday = $days[((7*$WEEK)+$DAY)];
229  
230 # Get the cell's coloration and CSS class
231 35 ▶ if ($self->year == $todayyear && $self->month == $todaymonth && $thisday == $todaydate) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate) { } 1 34 35
elsif ($DAY == $_sunday_index or $DAY == $_saturday_index) { } 10 24 34
Condition50%3/6
$self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate
!ll&&!rl&&r
0341
$self->year == $todayyear and $self->month == $todaymonth
!ll&&!rl&&r
0035
MC/DC33%1/3
$self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate
$self->year == $todayyear $self->month == $todaymonth $thisday == $todaydate
Truth table50%2/4
A and B and C
A= $self->year == $todayyearB= $self->month == $todaymonthC= $thisday == $todaydate
ABCresult
0XX0
10X0
1100
1111
232 1 ▶ $thisbgcolor = $self->datecolor($thisday) || $todaycolor;
Condition33%1/3
$self->datecolor($thisday) || $todaycolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datecolor($thisday) || $todaycolor
$self->datecolor($thisday) $todaycolor
Truth table33%1/3
A || B
A= $self->datecolor($thisday)B= $todaycolor
ABresult
1X1
011
000
233 1 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $todaybordercolor;
Condition33%1/3
$self->datebordercolor($thisday) || $todaybordercolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datebordercolor($thisday) || $todaybordercolor
$self->datebordercolor($thisday) $todaybordercolor
Truth table33%1/3
A || B
A= $self->datebordercolor($thisday)B= $todaybordercolor
ABresult
1X1
011
000
234 1 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $todaycontentcolor;
Condition33%1/3
$self->datecontentcolor($thisday) || $todaycontentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datecontentcolor($thisday) || $todaycontentcolor
$self->datecontentcolor($thisday) $todaycontentcolor
Truth table33%1/3
A || B
A= $self->datecontentcolor($thisday)B= $todaycontentcolor
ABresult
1X1
011
000
235 1 ▶ $thiscellclass = $self->datecellclass($thisday) || $todaycellclass;
Condition33%1/3
$self->datecellclass($thisday) || $todaycellclass
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datecellclass($thisday) || $todaycellclass
$self->datecellclass($thisday) $todaycellclass
Truth table33%1/3
A || B
A= $self->datecellclass($thisday)B= $todaycellclass
ABresult
1X1
011
000
236 ▶ } elsif (($DAY == $_sunday_index) || ($DAY == $_saturday_index)) {
Condition100%3/3
$DAY == $_sunday_index or $DAY == $_saturday_index
l!l&&r!l&&!r
5524
MC/DC100%2/2
$DAY == $_sunday_index or $DAY == $_saturday_index
$DAY == $_sunday_index $DAY == $_saturday_index
Truth table100%3/3
A or B
A= $DAY == $_sunday_indexB= $DAY == $_saturday_index
ABresult
1X1
011
000
237 10 ▶ $thisbgcolor = $self->datecolor($thisday) || $weekendcolor;
Condition33%1/3
$self->datecolor($thisday) || $weekendcolor
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datecolor($thisday) || $weekendcolor
$self->datecolor($thisday) $weekendcolor
Truth table33%1/3
A || B
A= $self->datecolor($thisday)B= $weekendcolor
ABresult
1X1
011
000
238 10 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $weekendbordercolor;
Condition33%1/3
$self->datebordercolor($thisday) || $weekendbordercolor
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datebordercolor($thisday) || $weekendbordercolor
$self->datebordercolor($thisday) $weekendbordercolor
Truth table33%1/3
A || B
A= $self->datebordercolor($thisday)B= $weekendbordercolor
ABresult
1X1
011
000
239 10 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $weekendcontentcolor;
Condition33%1/3
$self->datecontentcolor($thisday) || $weekendcontentcolor
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datecontentcolor($thisday) || $weekendcontentcolor
$self->datecontentcolor($thisday) $weekendcontentcolor
Truth table33%1/3
A || B
A= $self->datecontentcolor($thisday)B= $weekendcontentcolor
ABresult
1X1
011
000
240 10 ▶ $thiscellclass = $self->datecellclass($thisday) || $weekendcellclass;
Condition33%1/3
$self->datecellclass($thisday) || $weekendcellclass
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datecellclass($thisday) || $weekendcellclass
$self->datecellclass($thisday) $weekendcellclass
Truth table33%1/3
A || B
A= $self->datecellclass($thisday)B= $weekendcellclass
ABresult
1X1
011
000
241 } else {
242 24 ▶ $thisbgcolor = $self->datecolor($thisday) || $weekdaycolor;
Condition33%1/3
$self->datecolor($thisday) || $weekdaycolor
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datecolor($thisday) || $weekdaycolor
$self->datecolor($thisday) $weekdaycolor
Truth table33%1/3
A || B
A= $self->datecolor($thisday)B= $weekdaycolor
ABresult
1X1
011
000
243 24 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $weekdaybordercolor;
Condition33%1/3
$self->datebordercolor($thisday) || $weekdaybordercolor
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datebordercolor($thisday) || $weekdaybordercolor
$self->datebordercolor($thisday) $weekdaybordercolor
Truth table33%1/3
A || B
A= $self->datebordercolor($thisday)B= $weekdaybordercolor
ABresult
1X1
011
000
244 24 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $weekdaycontentcolor;
Condition33%1/3
$self->datecontentcolor($thisday) || $weekdaycontentcolor
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datecontentcolor($thisday) || $weekdaycontentcolor
$self->datecontentcolor($thisday) $weekdaycontentcolor
Truth table33%1/3
A || B
A= $self->datecontentcolor($thisday)B= $weekdaycontentcolor
ABresult
1X1
011
000
245 24 ▶ $thiscellclass = $self->datecellclass($thisday) || $weekdaycellclass;
Condition33%1/3
$self->datecellclass($thisday) || $weekdaycellclass
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datecellclass($thisday) || $weekdaycellclass
$self->datecellclass($thisday) $weekdaycellclass
Truth table33%1/3
A || B
A= $self->datecellclass($thisday)B= $weekdaycellclass
ABresult
1X1
011
000
246 }
247  
248 # mark the date, and we should count the events first.
249 35 ▶ my $rowspan = $prerow{$thisday} || (1 + $weekevents);
Condition66%2/3
$prerow{$thisday} || 1 + $weekevents
l!l&&r!l&&!r
3320
MC/DC0%0/2
$prerow{$thisday} || 1 + $weekevents
$prerow{$thisday} 1 + $weekevents
Truth table66%2/3
A || B
A= $prerow{$thisday}B= 1 + $weekevents
ABresult
1X1
011
000
250 # Done with this cell - push it into the table
251 35 $html .= "<td style=\"border-bottom-width:0px;\"";
252 35 ▶ $html .= " nowrap" if $nowrap;
Branch: 1 branch
BranchTrueFalseTotal
if $nowrap 0 35 35
253 35 ▶ $html .= " class=\"$thiscellclass\"" if defined $thiscellclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscellclass 0 35 35
254 35 ▶ $html .= " height=\"$cellheight\"" if defined $cellheight;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellheight 0 35 35
255 35 ▶ $html .= " width=\"$cellwidth\"" if defined $cellwidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellwidth 35 0 35
256 35 $html .= " valign=\"top\"";
257 35 ▶ $html .= " align=\"$cellalignment\"" if defined $cellalignment;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellalignment 35 0 35
258 35 ▶ $html .= " bgcolor=\"$thisbgcolor\"" if defined $thisbgcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thisbgcolor 0 35 35
259 35 ▶ $html .= " bordercolor=\"$thisbordercolor\"" if defined $thisbordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thisbordercolor 0 35 35
260 35 $html .= " rowspan=\"$rowspan\"";
261 35 $html .= ">";
262 35 ▶ $html .= "<font" if (defined $thiscontentcolor ||
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor or defined $contentfontsize 0 35 35
Condition33%1/3
defined $thiscontentcolor or defined $contentfontsize
l!l&&r!l&&!r
0035
MC/DC0%0/2
defined $thiscontentcolor or defined $contentfontsize
defined $thiscontentcolor defined $contentfontsize
Truth table33%1/3
A or B
A= defined $thiscontentcolorB= defined $contentfontsize
ABresult
1X1
011
000
263 defined $contentfontsize);
264 35 ▶ $html .= " color=\"$thiscontentcolor\"" if defined $thiscontentcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor 0 35 35
265 35 ▶ $html .= " size=\"$contentfontsize\"" if defined $contentfontsize;
Branch: 1 branch
BranchTrueFalseTotal
if defined $contentfontsize 0 35 35
266 35 ▶ $html .= ">" if (defined $thiscontentcolor ||
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor or defined $contentfontsize 0 35 35
Condition33%1/3
defined $thiscontentcolor or defined $contentfontsize
l!l&&r!l&&!r
0035
MC/DC0%0/2
defined $thiscontentcolor or defined $contentfontsize
defined $thiscontentcolor defined $contentfontsize
Truth table33%1/3
A or B
A= defined $thiscontentcolorB= defined $contentfontsize
ABresult
1X1
011
000
267 defined $contentfontsize);
268 35 ▶ $html .= "<b>$thisday</b>\n" if ($thisday);
Branch: 1 branch
BranchTrueFalseTotal
if $thisday 30 5 35
269 35 ▶ $html .= "</font>" if (defined $thiscontentcolor ||
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor or defined $contentfontsize 0 35 35
Condition33%1/3
defined $thiscontentcolor or defined $contentfontsize
l!l&&r!l&&!r
0035
MC/DC0%0/2
defined $thiscontentcolor or defined $contentfontsize
defined $thiscontentcolor defined $contentfontsize
Truth table33%1/3
A or B
A= defined $thiscontentcolorB= defined $contentfontsize
ABresult
1X1
011
000
270 defined $contentfontsize);
271 35 $html .= "</td>\n";
272 }
273 5 $html .= "</tr>\n";
274 5 my $i = 1;
275 5 for $DAY (0 .. 6) {
276 35 my $thisday = $days[((7*$WEEK)+$DAY)];
277 35 ▶ if (exists $self->{events}->{$thisday}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"events"}{$thisday}) 35 0 35
278 0 for my $event (sort { $a->{length} <=> $b->{length} } @{$self->{events}->{$thisday}}) {
279 1 my $colspan = $event->{length};
280 1 my $preoffset = $weekevents - $i + 1;
281 1 $html .= "<tr>\n";
282 1 for (0 .. ($thisday - $firstevent - 1)) {
283 0 ▶ if ($preoffset) {
Branch: 1 branch
BranchTrueFalseTotal
if ($preoffset) 0 0 0
284 0 $html .= "<td rowspan=$preoffset style=\"border-top-width:0px;border-bottom-width:0px;\" boder=0 class=\"calweekendcell\" width=\"14%\" valign=\"top\" align=\"left\"></td>\n";
285 }
286 }
287 1 $html .= "<td bgcolor=#EEE colspan=$colspan style=\"border-top-width:0px;border-bottom-width:0px;\" width=\"14%\" valign=\"top\">".$event->{event}."</td>\n";
288 1 $html .= "</tr>\n";
289 1 $firstevent = $thisday;
290 1 $i++;
291 }
292 }
293 }
294 5 $html .= "<tr style=\"line-height:4em;\">\n";
295 5 foreach $DAY ( 0 .. 6 ) {
296 35 my($thiscontent,$thisday,$thisbgcolor,$thisbordercolor,$thiscontentcolor,$thiscellclass);
297 35 $thisday = $days[((7*$WEEK)+$DAY)];
298  
299 # Get the cell's coloration and CSS class
300 35 ▶ if ($self->year == $todayyear && $self->month == $todaymonth && $thisday == $todaydate) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate) { } 1 34 35
elsif ($DAY == $_sunday_index or $DAY == $_saturday_index) { } 10 24 34
Condition50%3/6
$self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate
!ll&&!rl&&r
0341
$self->year == $todayyear and $self->month == $todaymonth
!ll&&!rl&&r
0035
MC/DC33%1/3
$self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate
$self->year == $todayyear $self->month == $todaymonth $thisday == $todaydate
Truth table50%2/4
A and B and C
A= $self->year == $todayyearB= $self->month == $todaymonthC= $thisday == $todaydate
ABCresult
0XX0
10X0
1100
1111
301 1 ▶ $thisbgcolor = $self->datecolor($thisday) || $todaycolor;
Condition33%1/3
$self->datecolor($thisday) || $todaycolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datecolor($thisday) || $todaycolor
$self->datecolor($thisday) $todaycolor
Truth table33%1/3
A || B
A= $self->datecolor($thisday)B= $todaycolor
ABresult
1X1
011
000
302 1 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $todaybordercolor;
Condition33%1/3
$self->datebordercolor($thisday) || $todaybordercolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datebordercolor($thisday) || $todaybordercolor
$self->datebordercolor($thisday) $todaybordercolor
Truth table33%1/3
A || B
A= $self->datebordercolor($thisday)B= $todaybordercolor
ABresult
1X1
011
000
303 1 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $todaycontentcolor;
Condition33%1/3
$self->datecontentcolor($thisday) || $todaycontentcolor
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datecontentcolor($thisday) || $todaycontentcolor
$self->datecontentcolor($thisday) $todaycontentcolor
Truth table33%1/3
A || B
A= $self->datecontentcolor($thisday)B= $todaycontentcolor
ABresult
1X1
011
000
304 1 ▶ $thiscellclass = $self->datecellclass($thisday) || $todaycellclass;
Condition33%1/3
$self->datecellclass($thisday) || $todaycellclass
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->datecellclass($thisday) || $todaycellclass
$self->datecellclass($thisday) $todaycellclass
Truth table33%1/3
A || B
A= $self->datecellclass($thisday)B= $todaycellclass
ABresult
1X1
011
000
305 ▶ } elsif (($DAY == $_sunday_index) || ($DAY == $_saturday_index)) {
Condition100%3/3
$DAY == $_sunday_index or $DAY == $_saturday_index
l!l&&r!l&&!r
5524
MC/DC100%2/2
$DAY == $_sunday_index or $DAY == $_saturday_index
$DAY == $_sunday_index $DAY == $_saturday_index
Truth table100%3/3
A or B
A= $DAY == $_sunday_indexB= $DAY == $_saturday_index
ABresult
1X1
011
000
306 10 ▶ $thisbgcolor = $self->datecolor($thisday) || $weekendcolor;
Condition33%1/3
$self->datecolor($thisday) || $weekendcolor
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datecolor($thisday) || $weekendcolor
$self->datecolor($thisday) $weekendcolor
Truth table33%1/3
A || B
A= $self->datecolor($thisday)B= $weekendcolor
ABresult
1X1
011
000
307 10 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $weekendbordercolor;
Condition33%1/3
$self->datebordercolor($thisday) || $weekendbordercolor
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datebordercolor($thisday) || $weekendbordercolor
$self->datebordercolor($thisday) $weekendbordercolor
Truth table33%1/3
A || B
A= $self->datebordercolor($thisday)B= $weekendbordercolor
ABresult
1X1
011
000
308 10 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $weekendcontentcolor;
Condition33%1/3
$self->datecontentcolor($thisday) || $weekendcontentcolor
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datecontentcolor($thisday) || $weekendcontentcolor
$self->datecontentcolor($thisday) $weekendcontentcolor
Truth table33%1/3
A || B
A= $self->datecontentcolor($thisday)B= $weekendcontentcolor
ABresult
1X1
011
000
309 10 ▶ $thiscellclass = $self->datecellclass($thisday) || $weekendcellclass;
Condition33%1/3
$self->datecellclass($thisday) || $weekendcellclass
l!l&&r!l&&!r
0010
MC/DC0%0/2
$self->datecellclass($thisday) || $weekendcellclass
$self->datecellclass($thisday) $weekendcellclass
Truth table33%1/3
A || B
A= $self->datecellclass($thisday)B= $weekendcellclass
ABresult
1X1
011
000
310 } else {
311 24 ▶ $thisbgcolor = $self->datecolor($thisday) || $weekdaycolor;
Condition33%1/3
$self->datecolor($thisday) || $weekdaycolor
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datecolor($thisday) || $weekdaycolor
$self->datecolor($thisday) $weekdaycolor
Truth table33%1/3
A || B
A= $self->datecolor($thisday)B= $weekdaycolor
ABresult
1X1
011
000
312 24 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $weekdaybordercolor;
Condition33%1/3
$self->datebordercolor($thisday) || $weekdaybordercolor
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datebordercolor($thisday) || $weekdaybordercolor
$self->datebordercolor($thisday) $weekdaybordercolor
Truth table33%1/3
A || B
A= $self->datebordercolor($thisday)B= $weekdaybordercolor
ABresult
1X1
011
000
313 24 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $weekdaycontentcolor;
Condition33%1/3
$self->datecontentcolor($thisday) || $weekdaycontentcolor
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datecontentcolor($thisday) || $weekdaycontentcolor
$self->datecontentcolor($thisday) $weekdaycontentcolor
Truth table33%1/3
A || B
A= $self->datecontentcolor($thisday)B= $weekdaycontentcolor
ABresult
1X1
011
000
314 24 ▶ $thiscellclass = $self->datecellclass($thisday) || $weekdaycellclass;
Condition33%1/3
$self->datecellclass($thisday) || $weekdaycellclass
l!l&&r!l&&!r
0024
MC/DC0%0/2
$self->datecellclass($thisday) || $weekdaycellclass
$self->datecellclass($thisday) $weekdaycellclass
Truth table33%1/3
A || B
A= $self->datecellclass($thisday)B= $weekdaycellclass
ABresult
1X1
011
000
315 }
316  
317 # mark the date, and we should count the events first.
318 35 ▶ my $rowspan = $prerow{$thisday} || (1+$weekevents);
Condition66%2/3
$prerow{$thisday} || 1 + $weekevents
l!l&&r!l&&!r
3320
MC/DC0%0/2
$prerow{$thisday} || 1 + $weekevents
$prerow{$thisday} 1 + $weekevents
Truth table66%2/3
A || B
A= $prerow{$thisday}B= 1 + $weekevents
ABresult
1X1
011
000
319 # Done with this cell - push it into the table
320 35 $html .= "<td style=\"line-height:5px;border-top-width:0px;line-height:4em;\"";
321 35 ▶ $html .= " nowrap" if $nowrap;
Branch: 1 branch
BranchTrueFalseTotal
if $nowrap 0 35 35
322 35 ▶ $html .= " class=\"$thiscellclass\"" if defined $thiscellclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscellclass 0 35 35
323 35 ▶ $html .= " height=\"$cellheight\"" if defined $cellheight;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellheight 0 35 35
324 35 ▶ $html .= " width=\"$cellwidth\"" if defined $cellwidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellwidth 35 0 35
325 35 ▶ $html .= " valign=\"$vcellalignment\"" if defined $vcellalignment;
Branch: 1 branch
BranchTrueFalseTotal
if defined $vcellalignment 35 0 35
326 35 ▶ $html .= " align=\"$cellalignment\"" if defined $cellalignment;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellalignment 35 0 35
327 35 ▶ $html .= " bgcolor=\"$thisbgcolor\"" if defined $thisbgcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thisbgcolor 0 35 35
328 35 ▶ $html .= " bordercolor=\"$thisbordercolor\"" if defined $thisbordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thisbordercolor 0 35 35
329 35 $html .= ">&nbsp;";
330 35 $html .= "</td>\n";
331 }
332 }
333 1 $html .= "</table>\n";
334  
335 # if sharpborders, we need to break out of the enclosing table cell
336 1 ▶ if ($sharpborders) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sharpborders) 0 1 1
337 0 $html .= "</td>\n</tr>\n</table>\n";
338 }
339  
340 1 return $html;
341 }
342  
343 1 ▶sub add_event {
Subroutine add_event: called CC=2 SCAR=6.9
Pod undocumented
344 1 my $self = shift;
345 1 my %params = @_;
346 1 my $date = $params{date};
347 1 $date =~ s/^0*//;
348 1 my $event = {};
349 1 $event->{event} = $params{event};
350 1 ▶ $event->{length} = $params{length} || 1;
Condition50%1/2
$params{'length'} || 1
l!l
10
MC/DC0%0/1
$params{'length'} || 1
$params{'length'}
Truth table50%1/2
A
A= $params{'length'}
Aresult
11
00
351 1 push @{$self->{events}->{$date}}, $event;
352 1 return 1;
353 }
354  
355 1 1;
356  
357 __END__
↑ Summary