blib/lib/HTML/CalendarMonthSimple.pm

filter: Statementstmt 9.7% 49 / 501 Branchbran 0.0% 0 / 248 Conditioncond 5.2% 8 / 152 MC/DCmcdc 0.0% 0 / 98 Subroutinesub 10.4% 7 / 67 Podpod 100% 63 / 63 totaltotal 11.2% 127 / 1129 CC 193 SCAR 83.6
CC
193
Cov
6%
as_HTML
10712.0
_date_string_to_numeric
56.0
setdatehref
30.0
CRAP 4268.1
↑ Summary
1 # HTML::CalendarMonthSimple.pm
2 # Generate HTML calendars. An alternative to HTML::CalendarMonth
3 # Herein, the symbol $self is used to refer to the object that's being passed around.
4  
5 package HTML::CalendarMonthSimple;
6 2 our $VERSION = "1.26";
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Date::Calc;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 # Within the constructor is the only place where values are access directly.
13 # Methods are provided for accessing/changing values, and those methods
14 # are used even internally.
15 # Most of the constructor is assigning default values.
16 sub new {
17 2 ▶ my $class = shift; $class = ref($class) || $class;
Subroutine new: called CC=8 SCAR=21.4
Pod documented
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
18 2 my $self = {}; %$self = @_; # Load ourselves up from the args
19  
20 # figure out the current date (which may be specified as today_year, et al
21 # then figure out which year+month we're supposed to display
22 {
23 2 my($year,$month,$date) = Date::Calc::Today();
24 2 ▶ $self->{'today_year'} = $self->{'today_year'} || $year;
Condition33%1/3
$self->{'today_year'} || $year
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->{'today_year'} || $year
$self->{'today_year'} $year
Truth table33%1/3
A || B
A= $self->{'today_year'}B= $year
ABresult
1X1
011
000
25 2 ▶ $self->{'today_month'} = $self->{'today_month'} || $month;
Condition33%1/3
$self->{'today_month'} || $month
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->{'today_month'} || $month
$self->{'today_month'} $month
Truth table33%1/3
A || B
A= $self->{'today_month'}B= $month
ABresult
1X1
011
000
26 2 ▶ $self->{'today_date'} = $self->{'today_date'} || $date;
Condition33%1/3
$self->{'today_date'} || $date
l!l&&r!l&&!r
020
MC/DC0%0/2
$self->{'today_date'} || $date
$self->{'today_date'} $date
Truth table33%1/3
A || B
A= $self->{'today_date'}B= $date
ABresult
1X1
011
000
27 2 ▶ $self->{'month'} = $self->{'month'} || $self->{'today_month'};
Condition66%2/3
$self->{'month'} || $self->{'today_month'}
l!l&&r!l&&!r
110
MC/DC0%0/2
$self->{'month'} || $self->{'today_month'}
$self->{'month'} $self->{'today_month'}
Truth table66%2/3
A || B
A= $self->{'month'}B= $self->{'today_month'}
ABresult
1X1
011
000
28 2 ▶ $self->{'year'} = $self->{'year'} || $self->{'today_year'};
Condition66%2/3
$self->{'year'} || $self->{'today_year'}
l!l&&r!l&&!r
110
MC/DC0%0/2
$self->{'year'} || $self->{'today_year'}
$self->{'year'} $self->{'today_year'}
Truth table66%2/3
A || B
A= $self->{'year'}B= $self->{'today_year'}
ABresult
1X1
011
000
29 2 $self->{'monthname'} = Date::Calc::Month_to_Text($self->{'month'});
30 }
31  
32 # Some defaults
33 2 $self->{'border'} = 5;
34 2 $self->{'width'} = '100%';
35 2 $self->{'showdatenumbers'} = 1;
36 2 $self->{'showweekdayheaders'} = 1;
37 2 $self->{'cellalignment'} = 'left';
38 2 $self->{'vcellalignment'} = 'top';
39 2 $self->{'weekdayheadersbig'} = 1;
40 2 $self->{'nowrap'} = 0;
41  
42 2 $self->{'weekdays'} = [qw/Monday Tuesday Wednesday Thursday Friday/];
43 2 $self->{'sunday'} = "Sunday";
44 2 $self->{'saturday'} = "Saturday";
45  
46 # Set the default calendar header
47 $self->{'header'} = sprintf("<center><font size=\"+2\">%s %d</font></center>",
48 2 Date::Calc::Month_to_Text($self->{'month'}),$self->{'year'});
49  
50 # Initialize the (empty) cell content so the keys are representative of the month
51 2 bless $self,$class;
52  
53 2 foreach my $datenumber ( 1 .. $self->Days_in_Month ) {
54 62 $self->{'content'}->{$datenumber} = '';
55 62 $self->{'datecellclass'}->{$datenumber} = '';
56 62 $self->{'datecolor'}->{$datenumber} = '';
57 62 $self->{'datebordercolor'}->{$datenumber} = '';
58 62 $self->{'datecontentcolor'}->{$datenumber} = '';
59 62 $self->{'href'}->{$datenumber} = '';
60 }
61  
62 # All done!
63 2 return $self;
64 }
65  
66  
67 sub as_HTML {
68 0 ▶ my $self = shift;
Subroutine as_HTML: not called CC=103 SCAR=92.8
Pod documented
69 0 my %params = @_;
70 0 my $html = '';
71 0 my(@days,$weeks,$WEEK,$DAY);
72  
73 # To make the grid even, pad the start of the series with 0s
74 0 @days = (1 .. $self->Days_in_Month );
75 0 ▶ if ($self->weekstartsonmonday()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->weekstartsonmonday) { } 0 0 0
76 0 foreach (1 .. (Date::Calc::Day_of_Week($self->year(),
77 $self->month(),1) -1 )) {
78 0 unshift(@days,0);
79 }
80 }
81 else {
82 0 foreach (1 .. (Date::Calc::Day_of_Week($self->year(),
83 $self->month(),1)%7) ) {
84 0 unshift(@days,0);
85 }
86 }
87 0 $weeks = int((scalar(@days)+6)/7);
88 # And pad the end as well, to avoid "uninitialized value" warnings
89 0 foreach (scalar(@days)+1 .. $weeks*7) {
90 0 push(@days,0);
91 }
92  
93 # Define some scalars for generating the table
94 0 my $border = $self->border();
95 0 my $tablewidth = $self->width();
96 0 my $cellwidth = "*";
97 0 ▶ if (defined($tablewidth) and $tablewidth =~ m/^(\d+)(\%?)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tablewidth and $tablewidth =~ /^(\d+)(\%?)$/) 0 0 0
Condition0%0/3
defined $tablewidth and $tablewidth =~ /^(\d+)(\%?)$/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $tablewidth and $tablewidth =~ /^(\d+)(\%?)$/
defined $tablewidth $tablewidth =~ /^(\d+)(\%?)$/
Truth table0%0/3
A and B
A= defined $tablewidthB= $tablewidth =~ /^(\d+)(\%?)$/
ABresult
0X0
100
111
98 0 ▶ $cellwidth = (int($1/7))||'14'; if ($2) { $cellwidth .= '%'; }
Branch: 1 branch
BranchTrueFalseTotal
if ($2) 0 0 0
Condition0%0/2
int $1 / 7 || '14'
l!l
00
MC/DC0%0/1
int $1 / 7 || '14'
int $1 / 7
Truth table0%0/2
A
A= int $1 / 7
Aresult
11
00
99 }
100 0 my $header = $self->header();
101 0 my $cellalignment = $self->cellalignment();
102 0 my $vcellalignment = $self->vcellalignment();
103 0 my $contentfontsize = $self->contentfontsize();
104 0 my $bgcolor = $self->bgcolor();
105 0 ▶ my $weekdaycolor = $self->weekdaycolor() || $self->bgcolor();
Condition0%0/3
$self->weekdaycolor || $self->bgcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekdaycolor || $self->bgcolor
$self->weekdaycolor $self->bgcolor
Truth table0%0/3
A || B
A= $self->weekdaycolorB= $self->bgcolor
ABresult
1X1
011
000
106 0 ▶ my $weekendcolor = $self->weekendcolor() || $self->bgcolor();
Condition0%0/3
$self->weekendcolor || $self->bgcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekendcolor || $self->bgcolor
$self->weekendcolor $self->bgcolor
Truth table0%0/3
A || B
A= $self->weekendcolorB= $self->bgcolor
ABresult
1X1
011
000
107 0 ▶ my $todaycolor = $self->todaycolor() || $self->bgcolor();
Condition0%0/3
$self->todaycolor || $self->bgcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->todaycolor || $self->bgcolor
$self->todaycolor $self->bgcolor
Truth table0%0/3
A || B
A= $self->todaycolorB= $self->bgcolor
ABresult
1X1
011
000
108 0 ▶ my $contentcolor = $self->contentcolor() || $self->contentcolor();
Condition0%0/3
$self->contentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->contentcolor || $self->contentcolor
$self->contentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->contentcolorB= $self->contentcolor
ABresult
1X1
011
000
109 0 ▶ my $weekdaycontentcolor = $self->weekdaycontentcolor() || $self->contentcolor();
Condition0%0/3
$self->weekdaycontentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekdaycontentcolor || $self->contentcolor
$self->weekdaycontentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->weekdaycontentcolorB= $self->contentcolor
ABresult
1X1
011
000
110 0 ▶ my $weekendcontentcolor = $self->weekendcontentcolor() || $self->contentcolor();
Condition0%0/3
$self->weekendcontentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekendcontentcolor || $self->contentcolor
$self->weekendcontentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->weekendcontentcolorB= $self->contentcolor
ABresult
1X1
011
000
111 0 ▶ my $todaycontentcolor = $self->todaycontentcolor() || $self->contentcolor();
Condition0%0/3
$self->todaycontentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->todaycontentcolor || $self->contentcolor
$self->todaycontentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->todaycontentcolorB= $self->contentcolor
ABresult
1X1
011
000
112 0 ▶ my $bordercolor = $self->bordercolor() || $self->bordercolor();
Condition0%0/3
$self->bordercolor || $self->bordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->bordercolor || $self->bordercolor
$self->bordercolor $self->bordercolor
Truth table0%0/3
A || B
A= $self->bordercolorB= $self->bordercolor
ABresult
1X1
011
000
113 0 ▶ my $weekdaybordercolor = $self->weekdaybordercolor() || $self->bordercolor();
Condition0%0/3
$self->weekdaybordercolor || $self->bordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekdaybordercolor || $self->bordercolor
$self->weekdaybordercolor $self->bordercolor
Truth table0%0/3
A || B
A= $self->weekdaybordercolorB= $self->bordercolor
ABresult
1X1
011
000
114 0 ▶ my $weekendbordercolor = $self->weekendbordercolor() || $self->bordercolor();
Condition0%0/3
$self->weekendbordercolor || $self->bordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekendbordercolor || $self->bordercolor
$self->weekendbordercolor $self->bordercolor
Truth table0%0/3
A || B
A= $self->weekendbordercolorB= $self->bordercolor
ABresult
1X1
011
000
115 0 ▶ my $todaybordercolor = $self->todaybordercolor() || $self->bordercolor();
Condition0%0/3
$self->todaybordercolor || $self->bordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->todaybordercolor || $self->bordercolor
$self->todaybordercolor $self->bordercolor
Truth table0%0/3
A || B
A= $self->todaybordercolorB= $self->bordercolor
ABresult
1X1
011
000
116 0 ▶ my $weekdayheadercolor = $self->weekdayheadercolor() || $self->bgcolor();
Condition0%0/3
$self->weekdayheadercolor || $self->bgcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekdayheadercolor || $self->bgcolor
$self->weekdayheadercolor $self->bgcolor
Truth table0%0/3
A || B
A= $self->weekdayheadercolorB= $self->bgcolor
ABresult
1X1
011
000
117 0 ▶ my $weekendheadercolor = $self->weekendheadercolor() || $self->bgcolor();
Condition0%0/3
$self->weekendheadercolor || $self->bgcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekendheadercolor || $self->bgcolor
$self->weekendheadercolor $self->bgcolor
Truth table0%0/3
A || B
A= $self->weekendheadercolorB= $self->bgcolor
ABresult
1X1
011
000
118 0 ▶ my $headercontentcolor = $self->headercontentcolor() || $self->contentcolor();
Condition0%0/3
$self->headercontentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->headercontentcolor || $self->contentcolor
$self->headercontentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->headercontentcolorB= $self->contentcolor
ABresult
1X1
011
000
119 0 ▶ my $weekdayheadercontentcolor = $self->weekdayheadercontentcolor() || $self->contentcolor();
Condition0%0/3
$self->weekdayheadercontentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekdayheadercontentcolor || $self->contentcolor
$self->weekdayheadercontentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->weekdayheadercontentcolorB= $self->contentcolor
ABresult
1X1
011
000
120 0 ▶ my $weekendheadercontentcolor = $self->weekendheadercontentcolor() || $self->contentcolor();
Condition0%0/3
$self->weekendheadercontentcolor || $self->contentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekendheadercontentcolor || $self->contentcolor
$self->weekendheadercontentcolor $self->contentcolor
Truth table0%0/3
A || B
A= $self->weekendheadercontentcolorB= $self->contentcolor
ABresult
1X1
011
000
121 0 ▶ my $headercolor = $self->headercolor() || $self->bgcolor();
Condition0%0/3
$self->headercolor || $self->bgcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->headercolor || $self->bgcolor
$self->headercolor $self->bgcolor
Truth table0%0/3
A || B
A= $self->headercolorB= $self->bgcolor
ABresult
1X1
011
000
122 0 my $cellpadding = $self->cellpadding();
123 0 my $cellspacing = $self->cellspacing();
124 0 my $sharpborders = $self->sharpborders();
125 0 my $cellheight = $self->cellheight();
126 0 my $cellclass = $self->cellclass();
127 0 my $tableclass = $self->tableclass();
128 0 ▶ my $weekdaycellclass = $self->weekdaycellclass() || $self->cellclass();
Condition0%0/3
$self->weekdaycellclass || $self->cellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekdaycellclass || $self->cellclass
$self->weekdaycellclass $self->cellclass
Truth table0%0/3
A || B
A= $self->weekdaycellclassB= $self->cellclass
ABresult
1X1
011
000
129 0 ▶ my $weekendcellclass = $self->weekendcellclass() || $self->cellclass();
Condition0%0/3
$self->weekendcellclass || $self->cellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->weekendcellclass || $self->cellclass
$self->weekendcellclass $self->cellclass
Truth table0%0/3
A || B
A= $self->weekendcellclassB= $self->cellclass
ABresult
1X1
011
000
130 0 ▶ my $todaycellclass = $self->todaycellclass() || $self->cellclass();
Condition0%0/3
$self->todaycellclass || $self->cellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->todaycellclass || $self->cellclass
$self->todaycellclass $self->cellclass
Truth table0%0/3
A || B
A= $self->todaycellclassB= $self->cellclass
ABresult
1X1
011
000
131 0 ▶ my $headerclass = $self->headerclass() || $self->cellclass();
Condition0%0/3
$self->headerclass || $self->cellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->headerclass || $self->cellclass
$self->headerclass $self->cellclass
Truth table0%0/3
A || B
A= $self->headerclassB= $self->cellclass
ABresult
1X1
011
000
132 0 my $nowrap = $self->nowrap();
133  
134 # Get today's date, in case there's a todaycolor()
135 0 my($todayyear,$todaymonth,$todaydate) = ($self->today_year(),$self->today_month(),$self->today_date());
136  
137 # the table declaration - sharpborders wraps the table inside a table cell
138 0 ▶ if ($sharpborders) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sharpborders) { } 0 0 0
139 0 $html .= "<table border=\"0\"";
140 0 ▶ $html .= " class=\"$tableclass\"" if defined $tableclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tableclass 0 0 0
141 0 ▶ $html .= " width=\"$tablewidth\"" if defined $tablewidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tablewidth 0 0 0
142 0 $html .= " cellpadding=\"0\" cellspacing=\"0\">\n";
143 0 $html .= "<tr valign=\"top\" align=\"left\">\n";
144 0 $html .= "<td align=\"left\" valign=\"top\"";
145 0 ▶ $html .= " bgcolor=\"$bordercolor\"" if defined $bordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $bordercolor 0 0 0
146 0 $html .= ">";
147 0 $html .= "<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\">";
148 }
149 else {
150 0 $html .= "<table";
151 0 ▶ $html .= " class=\"$tableclass\"" if defined $tableclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tableclass 0 0 0
152 0 ▶ $html .= " border=\"$border\"" if defined $border;
Branch: 1 branch
BranchTrueFalseTotal
if defined $border 0 0 0
153 0 ▶ $html .= " width=\"$tablewidth\"" if defined $tablewidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tablewidth 0 0 0
154 0 ▶ $html .= " bgcolor=\"$bgcolor\"" if defined $bgcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $bgcolor 0 0 0
155 0 ▶ $html .= " bordercolor=\"$bordercolor\"" if defined $bordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $bordercolor 0 0 0
156 0 ▶ $html .= " cellpadding=\"$cellpadding\"" if defined $cellpadding;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellpadding 0 0 0
157 0 ▶ $html .= " cellspacing=\"$cellspacing\"" if defined $cellspacing;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellspacing 0 0 0
158 0 $html .= ">\n";
159 }
160 # the header
161 0 ▶ if ($header) {
Branch: 1 branch
BranchTrueFalseTotal
if ($header) 0 0 0
162 0 $html .= "<tr><td colspan=\"7\"";
163 0 ▶ $html .= " bgcolor=\"$headercolor\"" if defined $headercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercolor 0 0 0
164 0 ▶ $html .= " class=\"$headerclass\"" if defined $headerclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headerclass 0 0 0
165 0 $html .= ">";
166 0 ▶ $html .= "<font color=\"$headercontentcolor\">" if defined $headercontentcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercontentcolor 0 0 0
167 0 $html .= $header;
168 0 ▶ $html .= "</font>" if defined $headercontentcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercontentcolor 0 0 0
169 0 $html .= "</td></tr>\n";
170 }
171 # the names of the days of the week
172 0 ▶ if ($self->showweekdayheaders) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->showweekdayheaders) 0 0 0
173 0 ▶ my $celltype = $self->weekdayheadersbig() ? "th" : "td";
Branch: 1 branch
BranchTrueFalseTotal
$self->weekdayheadersbig ? : 0 0 0
174 0 my @weekdays = $self->weekdays();
175  
176 0 ▶ my $saturday_html = "<$celltype"
Branch: 4 branches
BranchTrueFalseTotal
defined $weekendheadercolor ? : 0 0 0
defined $weekendcellclass ? : 0 0 0
defined $weekendheadercontentcolor ? : 0 0 0
defined $weekendheadercontentcolor ? : 0 0 0
177 . ( defined $weekendheadercolor
178 ? qq| bgcolor="$weekendheadercolor"|
179 : '' )
180 . ( defined $weekendcellclass
181 ? qq| class="$weekendcellclass"|
182 : '' )
183 . ">"
184 . ( defined $weekendheadercontentcolor
185 ? qq|<font color="$weekendheadercontentcolor">|
186 : '' )
187 . $self->saturday()
188 . ( defined $weekendheadercontentcolor
189 ? qq|</font>|
190 : '' )
191 . "</$celltype>\n";
192  
193 0 ▶ my $sunday_html = "<$celltype"
Branch: 4 branches
BranchTrueFalseTotal
defined $weekendheadercolor ? : 0 0 0
defined $weekendcellclass ? : 0 0 0
defined $weekendheadercontentcolor ? : 0 0 0
defined $weekendheadercontentcolor ? : 0 0 0
194 . ( defined $weekendheadercolor
195 ? qq| bgcolor="$weekendheadercolor"|
196 : '' )
197 . ( defined $weekendcellclass
198 ? qq| class="$weekendcellclass"|
199 : '' )
200 . ">"
201 . ( defined $weekendheadercontentcolor
202 ? qq|<font color="$weekendheadercontentcolor">|
203 : '' )
204 . $self->sunday()
205 . ( defined $weekendheadercontentcolor
206 ? qq|</font>|
207 : '' )
208 . "</$celltype>\n";
209
210 0 my $weekday_html = '';
211 0 foreach (@weekdays) { # draw the weekday headers
212  
213 0 ▶ $weekday_html .= "<$celltype"
Branch: 4 branches
BranchTrueFalseTotal
defined $weekendheadercolor ? : 0 0 0
defined $weekendcellclass ? : 0 0 0
defined $weekdayheadercontentcolor ? : 0 0 0
defined $weekdayheadercontentcolor ? : 0 0 0
214 . ( defined $weekendheadercolor
215 ? qq| bgcolor="$weekdayheadercolor"|
216 : '' )
217 . ( defined $weekendcellclass
218 ? qq| class="$weekdaycellclass"|
219 : '' )
220 . ">"
221 . ( defined $weekdayheadercontentcolor
222 ? qq|<font color="$weekdayheadercontentcolor">|
223 : '' )
224 . $_
225 . ( defined $weekdayheadercontentcolor
226 ? qq|</font>|
227 : '' )
228 . "</$celltype>\n";
229 }
230  
231 0 $html .= "<tr>\n";
232 0 ▶ if ($self->weekstartsonmonday()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->weekstartsonmonday) { } 0 0 0
233 0 $html .= $weekday_html
234 . $saturday_html
235 . $sunday_html;
236 }
237 else {
238 0 $html .= $sunday_html
239 . $weekday_html
240 . $saturday_html;
241 }
242 0 $html .= "</tr>\n";
243 }
244  
245 0 my $_saturday_index = 6;
246 0 my $_sunday_index = 0;
247 0 ▶ if ($self->weekstartsonmonday()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->weekstartsonmonday) 0 0 0
248 0 $_saturday_index = 5;
249 0 $_sunday_index = 6;
250 }
251 # now do each day, the actual date-content-containing cells
252 0 foreach $WEEK (0 .. ($weeks-1)) {
253 0 $html .= "<tr>\n";
254  
255
256 0 foreach $DAY ( 0 .. 6 ) {
257 0 my($thiscontent,$thisday,$thisbgcolor,$thisbordercolor,$thiscontentcolor,$thiscellclass);
258 0 $thisday = $days[((7*$WEEK)+$DAY)];
259  
260 # Get the cell content
261 0 ▶ if (! $thisday) { # If it's a dummy cell, no content
Branch: 1 branch
BranchTrueFalseTotal
if (not $thisday) { } 0 0 0
262 0 $thiscontent = '&nbsp;'; }
263 else { # A real date cell with potential content
264 # Get the content
265 0 ▶ if ($self->showdatenumbers()) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->showdatenumbers) 0 0 0
266 0 ▶ if ( $self->getdatehref( $thisday )) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->getdatehref($thisday)) { } 0 0 0
267 0 $thiscontent = "<p><b><a href=\"".$self->getdatehref($thisday);
268 0 $thiscontent .= "\">$thisday</a></b></p>\n";
269 } else {
270 0 $thiscontent = "<p><b>$thisday</b></p>\n";
271 }
272 }
273 0 $thiscontent .= $self->{'content'}->{$thisday};
274 0 ▶ $thiscontent ||= '&nbsp;';
Condition0%0/2
$thiscontent ||= "&nbsp;"
l!l
00
MC/DC0%0/1
$thiscontent ||= "&nbsp;"
$thiscontent
Truth table0%0/2
A
A= $thiscontent
Aresult
11
00
275 }
276  
277 # Get the cell's coloration and CSS class
278 0 ▶ if ($self->year == $todayyear && $self->month == $todaymonth && $thisday == $todaydate)
Branch: 2 branches
BranchTrueFalseTotal
if ($self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate) { } 0 0 0
elsif ($DAY == $_sunday_index or $DAY == $_saturday_index) { } 0 0 0
Condition0%0/6
$self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate
!ll&&!rl&&r
000
$self->year == $todayyear and $self->month == $todaymonth
!ll&&!rl&&r
000
MC/DC0%0/3
$self->year == $todayyear and $self->month == $todaymonth and $thisday == $todaydate
$self->year == $todayyear $self->month == $todaymonth $thisday == $todaydate
Truth table0%0/4
A and B and C
A= $self->year == $todayyearB= $self->month == $todaymonthC= $thisday == $todaydate
ABCresult
0XX0
10X0
1100
1111
279 0 ▶ { $thisbgcolor = $self->datecolor($thisday) || $todaycolor;
Condition0%0/3
$self->datecolor($thisday) || $todaycolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecolor($thisday) || $todaycolor
$self->datecolor($thisday) $todaycolor
Truth table0%0/3
A || B
A= $self->datecolor($thisday)B= $todaycolor
ABresult
1X1
011
000
280 0 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $todaybordercolor;
Condition0%0/3
$self->datebordercolor($thisday) || $todaybordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datebordercolor($thisday) || $todaybordercolor
$self->datebordercolor($thisday) $todaybordercolor
Truth table0%0/3
A || B
A= $self->datebordercolor($thisday)B= $todaybordercolor
ABresult
1X1
011
000
281 0 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $todaycontentcolor;
Condition0%0/3
$self->datecontentcolor($thisday) || $todaycontentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecontentcolor($thisday) || $todaycontentcolor
$self->datecontentcolor($thisday) $todaycontentcolor
Truth table0%0/3
A || B
A= $self->datecontentcolor($thisday)B= $todaycontentcolor
ABresult
1X1
011
000
282 0 ▶ $thiscellclass = $self->datecellclass($thisday) || $todaycellclass;
Condition0%0/3
$self->datecellclass($thisday) || $todaycellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecellclass($thisday) || $todaycellclass
$self->datecellclass($thisday) $todaycellclass
Truth table0%0/3
A || B
A= $self->datecellclass($thisday)B= $todaycellclass
ABresult
1X1
011
000
283 }
284 0 ▶ elsif (($DAY == $_sunday_index) || ($DAY == $_saturday_index)) { $thisbgcolor = $self->datecolor($thisday) || $weekendcolor;
Condition0%0/6
$DAY == $_sunday_index or $DAY == $_saturday_index
l!l&&r!l&&!r
000
$self->datecolor($thisday) || $weekendcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$DAY == $_sunday_index or $DAY == $_saturday_index
$DAY == $_sunday_index $DAY == $_saturday_index
MC/DC0%0/2
$self->datecolor($thisday) || $weekendcolor
$self->datecolor($thisday) $weekendcolor
Truth table0%0/3
A or B
A= $DAY == $_sunday_indexB= $DAY == $_saturday_index
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $self->datecolor($thisday)B= $weekendcolor
ABresult
1X1
011
000
285 0 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $weekendbordercolor;
Condition0%0/3
$self->datebordercolor($thisday) || $weekendbordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datebordercolor($thisday) || $weekendbordercolor
$self->datebordercolor($thisday) $weekendbordercolor
Truth table0%0/3
A || B
A= $self->datebordercolor($thisday)B= $weekendbordercolor
ABresult
1X1
011
000
286 0 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $weekendcontentcolor;
Condition0%0/3
$self->datecontentcolor($thisday) || $weekendcontentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecontentcolor($thisday) || $weekendcontentcolor
$self->datecontentcolor($thisday) $weekendcontentcolor
Truth table0%0/3
A || B
A= $self->datecontentcolor($thisday)B= $weekendcontentcolor
ABresult
1X1
011
000
287 0 ▶ $thiscellclass = $self->datecellclass($thisday) || $weekendcellclass;
Condition0%0/3
$self->datecellclass($thisday) || $weekendcellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecellclass($thisday) || $weekendcellclass
$self->datecellclass($thisday) $weekendcellclass
Truth table0%0/3
A || B
A= $self->datecellclass($thisday)B= $weekendcellclass
ABresult
1X1
011
000
288 }
289 0 ▶ else { $thisbgcolor = $self->datecolor($thisday) || $weekdaycolor;
Condition0%0/3
$self->datecolor($thisday) || $weekdaycolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecolor($thisday) || $weekdaycolor
$self->datecolor($thisday) $weekdaycolor
Truth table0%0/3
A || B
A= $self->datecolor($thisday)B= $weekdaycolor
ABresult
1X1
011
000
290 0 ▶ $thisbordercolor = $self->datebordercolor($thisday) || $weekdaybordercolor;
Condition0%0/3
$self->datebordercolor($thisday) || $weekdaybordercolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datebordercolor($thisday) || $weekdaybordercolor
$self->datebordercolor($thisday) $weekdaybordercolor
Truth table0%0/3
A || B
A= $self->datebordercolor($thisday)B= $weekdaybordercolor
ABresult
1X1
011
000
291 0 ▶ $thiscontentcolor = $self->datecontentcolor($thisday) || $weekdaycontentcolor;
Condition0%0/3
$self->datecontentcolor($thisday) || $weekdaycontentcolor
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecontentcolor($thisday) || $weekdaycontentcolor
$self->datecontentcolor($thisday) $weekdaycontentcolor
Truth table0%0/3
A || B
A= $self->datecontentcolor($thisday)B= $weekdaycontentcolor
ABresult
1X1
011
000
292 0 ▶ $thiscellclass = $self->datecellclass($thisday) || $weekdaycellclass;
Condition0%0/3
$self->datecellclass($thisday) || $weekdaycellclass
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->datecellclass($thisday) || $weekdaycellclass
$self->datecellclass($thisday) $weekdaycellclass
Truth table0%0/3
A || B
A= $self->datecellclass($thisday)B= $weekdaycellclass
ABresult
1X1
011
000
293 }
294  
295 # Done with this cell - push it into the table
296 0 $html .= "<td";
297 0 ▶ $html .= " nowrap" if $nowrap;
Branch: 1 branch
BranchTrueFalseTotal
if $nowrap 0 0 0
298 0 ▶ $html .= " class=\"$thiscellclass\"" if defined $thiscellclass;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscellclass 0 0 0
299 0 ▶ $html .= " height=\"$cellheight\"" if defined $cellheight;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellheight 0 0 0
300 0 ▶ $html .= " width=\"$cellwidth\"" if defined $cellwidth;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellwidth 0 0 0
301 0 ▶ $html .= " valign=\"$vcellalignment\"" if defined $vcellalignment;
Branch: 1 branch
BranchTrueFalseTotal
if defined $vcellalignment 0 0 0
302 0 ▶ $html .= " align=\"$cellalignment\"" if defined $cellalignment;
Branch: 1 branch
BranchTrueFalseTotal
if defined $cellalignment 0 0 0
303 0 ▶ $html .= " bgcolor=\"$thisbgcolor\"" if defined $thisbgcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thisbgcolor 0 0 0
304 0 ▶ $html .= " bordercolor=\"$thisbordercolor\"" if defined $thisbordercolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thisbordercolor 0 0 0
305 0 $html .= ">";
306 0 ▶ $html .= "<font" if (defined $thiscontentcolor ||
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor or defined $contentfontsize 0 0 0
Condition0%0/3
defined $thiscontentcolor or defined $contentfontsize
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $thiscontentcolor or defined $contentfontsize
defined $thiscontentcolor defined $contentfontsize
Truth table0%0/3
A or B
A= defined $thiscontentcolorB= defined $contentfontsize
ABresult
1X1
011
000
307 defined $contentfontsize);
308 0 ▶ $html .= " color=\"$thiscontentcolor\"" if defined $thiscontentcolor;
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor 0 0 0
309 0 ▶ $html .= " size=\"$contentfontsize\"" if defined $contentfontsize;
Branch: 1 branch
BranchTrueFalseTotal
if defined $contentfontsize 0 0 0
310 0 ▶ $html .= ">" if (defined $thiscontentcolor ||
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor or defined $contentfontsize 0 0 0
Condition0%0/3
defined $thiscontentcolor or defined $contentfontsize
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $thiscontentcolor or defined $contentfontsize
defined $thiscontentcolor defined $contentfontsize
Truth table0%0/3
A or B
A= defined $thiscontentcolorB= defined $contentfontsize
ABresult
1X1
011
000
311 defined $contentfontsize);
312 0 $html .= $thiscontent;
313 0 ▶ $html .= "</font>" if (defined $thiscontentcolor ||
Branch: 1 branch
BranchTrueFalseTotal
if defined $thiscontentcolor or defined $contentfontsize 0 0 0
Condition0%0/3
defined $thiscontentcolor or defined $contentfontsize
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $thiscontentcolor or defined $contentfontsize
defined $thiscontentcolor defined $contentfontsize
Truth table0%0/3
A or B
A= defined $thiscontentcolorB= defined $contentfontsize
ABresult
1X1
011
000
314 defined $contentfontsize);
315 0 $html .= "</td>\n";
316 }
317 0 $html .= "</tr>\n";
318 }
319 0 $html .= "</table>\n";
320  
321 # if sharpborders, we need to break out of the enclosing table cell
322 0 ▶ if ($sharpborders) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sharpborders) 0 0 0
323 0 $html .= "</td>\n</tr>\n</table>\n";
324 }
325  
326 0 return $html;
327 }
328  
329  
330  
331 sub sunday {
332 0 ▶ my $self = shift;
Subroutine sunday: not called CC=2 SCAR=17.9
Pod documented
333 0 my $newvalue = shift;
334 0 ▶ $self->{'sunday'} = $newvalue if defined($newvalue);
Branch: 1 branch
BranchTrueFalseTotal
if defined $newvalue 0 0 0
335 0 return $self->{'sunday'};
336 }
337  
338 sub saturday {
339 0 ▶ my $self = shift;
Subroutine saturday: not called CC=2 SCAR=17.9
Pod documented
340 0 my $newvalue = shift;
341 0 ▶ $self->{'saturday'} = $newvalue if defined($newvalue);
Branch: 1 branch
BranchTrueFalseTotal
if defined $newvalue 0 0 0
342 0 return $self->{'saturday'};
343 }
344  
345 sub weekdays {
346 0 ▶ my $self = shift;
Subroutine weekdays: not called CC=2 SCAR=17.9
Pod documented
347 0 my @days = @_;
348 0 ▶ $self->{'weekdays'} = \@days if (scalar(@days)==5);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @days == 5 0 0 0
349 0 return @{$self->{'weekdays'}};
350 }
351  
352 sub getdatehref {
353 0 ▶ my $self = shift;
Subroutine getdatehref: not called CC=2 SCAR=17.9
Pod documented
354 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
355 0 return $self->{'href'}->{$dates[0]};
356 }
357  
358 sub setdatehref {
359 0 ▶ my $self = shift;
Subroutine setdatehref: not called CC=5 SCAR=34.0
Pod documented
360 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
361 0 ▶ my $datehref = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
362  
363 0 foreach my $date (@dates) {
364 0 ▶ $self->{'href'}->{$date} = $datehref if defined($self->{'href'}->{$date});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"href"}{$date} 0 0 0
365 }
366  
367 0 return(1);
368 }
369  
370 sub weekendcolor {
371 0 ▶ my $self = shift;
Subroutine weekendcolor: not called CC=2 SCAR=17.9
Pod documented
372 0 my $newvalue = shift;
373 0 ▶ if (defined($newvalue)) { $self->{'weekendcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
374 0 return $self->{'weekendcolor'};
375 }
376  
377 sub weekendheadercolor {
378 0 ▶ my $self = shift;
Subroutine weekendheadercolor: not called CC=2 SCAR=17.9
Pod documented
379 0 my $newvalue = shift;
380 0 ▶ if (defined($newvalue)) { $self->{'weekendheadercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
381 0 return $self->{'weekendheadercolor'};
382 }
383  
384 sub weekdayheadercolor {
385 0 ▶ my $self = shift;
Subroutine weekdayheadercolor: not called CC=2 SCAR=17.9
Pod documented
386 0 my $newvalue = shift;
387 0 ▶ if (defined($newvalue)) { $self->{'weekdayheadercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
388 0 return $self->{'weekdayheadercolor'};
389 }
390  
391 sub weekdaycolor {
392 0 ▶ my $self = shift;
Subroutine weekdaycolor: not called CC=2 SCAR=17.9
Pod documented
393 0 my $newvalue = shift;
394 0 ▶ if (defined($newvalue)) { $self->{'weekdaycolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
395 0 return $self->{'weekdaycolor'};
396 }
397  
398 sub headercolor {
399 0 ▶ my $self = shift;
Subroutine headercolor: not called CC=2 SCAR=17.9
Pod documented
400 0 my $newvalue = shift;
401 0 ▶ if (defined($newvalue)) { $self->{'headercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
402 0 return $self->{'headercolor'};
403 }
404  
405 sub bgcolor {
406 0 ▶ my $self = shift;
Subroutine bgcolor: not called CC=2 SCAR=17.9
Pod documented
407 0 my $newvalue = shift;
408 0 ▶ if (defined($newvalue)) { $self->{'bgcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
409 0 return $self->{'bgcolor'};
410 }
411  
412 sub todaycolor {
413 0 ▶ my $self = shift;
Subroutine todaycolor: not called CC=2 SCAR=17.9
Pod documented
414 0 my $newvalue = shift;
415 0 ▶ if (defined($newvalue)) { $self->{'todaycolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
416 0 return $self->{'todaycolor'};
417 }
418  
419 sub bordercolor {
420 0 ▶ my $self = shift;
Subroutine bordercolor: not called CC=2 SCAR=17.9
Pod documented
421 0 my $newvalue = shift;
422 0 ▶ if (defined($newvalue)) { $self->{'bordercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
423 0 return $self->{'bordercolor'};
424 }
425  
426 sub highlightbordercolor {
427 0 ▶ my $self=shift;
Subroutine highlightbordercolor: not called CC=3 SCAR=24.8
Pod documented
428 0 ▶ $self->{"highlightbordercolorhighlight"}=shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
429 $self->{"highlightbordercolorhighlight"}="#2E2E2E"
430 0 ▶ unless defined($self->{"highlightbordercolorhighlight"});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"highlightbordercolorhighlight"} 0 0 0
431 0 return $self->{"highlightbordercolorhighlight"};
432 }
433  
434 sub weekdaybordercolor {
435 0 ▶ my $self = shift;
Subroutine weekdaybordercolor: not called CC=2 SCAR=17.9
Pod documented
436 0 my $newvalue = shift;
437 0 ▶ if (defined($newvalue)) { $self->{'weekdaybordercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
438 0 return $self->{'weekdaybordercolor'};
439 }
440  
441 sub weekendbordercolor {
442 0 ▶ my $self = shift;
Subroutine weekendbordercolor: not called CC=2 SCAR=17.9
Pod documented
443 0 my $newvalue = shift;
444 0 ▶ if (defined($newvalue)) { $self->{'weekendbordercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
445 0 return $self->{'weekendbordercolor'};
446 }
447  
448 sub todaybordercolor {
449 0 ▶ my $self = shift;
Subroutine todaybordercolor: not called CC=2 SCAR=17.9
Pod documented
450 0 my $newvalue = shift;
451 0 ▶ if (defined($newvalue)) { $self->{'todaybordercolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
452 0 return $self->{'todaybordercolor'};
453 }
454  
455 sub contentcolor {
456 0 ▶ my $self = shift;
Subroutine contentcolor: not called CC=2 SCAR=17.9
Pod documented
457 0 my $newvalue = shift;
458 0 ▶ if (defined($newvalue)) { $self->{'contentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
459 0 return $self->{'contentcolor'};
460 }
461  
462 sub highlightcontentcolor {
463 0 ▶ my $self=shift;
Subroutine highlightcontentcolor: not called CC=3 SCAR=24.8
Pod documented
464 0 ▶ $self->{"highlightcontentcolor"}=shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
465 $self->{"highlightcontentcolor"}="#FEFEE2"
466 0 ▶ unless defined $self->{"highlightcontentcolor"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"highlightcontentcolor"} 0 0 0
467 0 return $self->{"highlightcontentcolor"};
468 }
469  
470 sub headercontentcolor {
471 0 ▶ my $self = shift;
Subroutine headercontentcolor: not called CC=2 SCAR=17.9
Pod documented
472 0 my $newvalue = shift;
473 0 ▶ if (defined($newvalue)) { $self->{'headercontentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
474 0 return $self->{'headercontentcolor'};
475 }
476  
477 sub weekdayheadercontentcolor {
478 0 ▶ my $self = shift;
Subroutine weekdayheadercontentcolor: not called CC=2 SCAR=17.9
Pod documented
479 0 my $newvalue = shift;
480 0 ▶ if (defined($newvalue)) { $self->{'weekdayheadercontentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
481 0 return $self->{'weekdayheadercontentcolor'};
482 }
483  
484 sub weekendheadercontentcolor {
485 0 ▶ my $self = shift;
Subroutine weekendheadercontentcolor: not called CC=2 SCAR=17.9
Pod documented
486 0 my $newvalue = shift;
487 0 ▶ if (defined($newvalue)) { $self->{'weekendheadercontentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
488 0 return $self->{'weekendheadercontentcolor'};
489 }
490  
491 sub weekdaycontentcolor {
492 0 ▶ my $self = shift;
Subroutine weekdaycontentcolor: not called CC=2 SCAR=17.9
Pod documented
493 0 my $newvalue = shift;
494 0 ▶ if (defined($newvalue)) { $self->{'weekdaycontentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
495 0 return $self->{'weekdaycontentcolor'};
496 }
497  
498 sub weekendcontentcolor {
499 0 ▶ my $self = shift;
Subroutine weekendcontentcolor: not called CC=2 SCAR=17.9
Pod documented
500 0 my $newvalue = shift;
501 0 ▶ if (defined($newvalue)) { $self->{'weekendcontentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
502 0 return $self->{'weekendcontentcolor'};
503 }
504  
505 sub todaycontentcolor {
506 0 ▶ my $self = shift;
Subroutine todaycontentcolor: not called CC=2 SCAR=17.9
Pod documented
507 0 my $newvalue = shift;
508 0 ▶ if (defined($newvalue)) { $self->{'todaycontentcolor'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
509 0 return $self->{'todaycontentcolor'};
510 }
511  
512 sub datecolor {
513 0 ▶ my $self = shift;
Subroutine datecolor: not called CC=5 SCAR=34.0
Pod documented
514 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
515 0 my $newvalue = shift;
516  
517 0 ▶ if (defined($newvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
518 0 foreach my $date (@dates) {
519 0 ▶ $self->{'datecolor'}->{$date} = $newvalue if defined($self->{'datecolor'}->{$date});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"datecolor"}{$date} 0 0 0
520 }
521 }
522  
523 0 return $self->{'datecolor'}->{$dates[0]};
524 }
525  
526 sub datebordercolor {
527 0 ▶ my $self = shift;
Subroutine datebordercolor: not called CC=5 SCAR=34.0
Pod documented
528 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
529 0 my $newvalue = shift;
530  
531 0 ▶ if (defined($newvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
532 0 foreach my $date (@dates) {
533 0 ▶ $self->{'datebordercolor'}->{$date} = $newvalue if defined($self->{'datebordercolor'}->{$date});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"datebordercolor"}{$date} 0 0 0
534 }
535 }
536  
537 0 return $self->{'datebordercolor'}->{$dates[0]};
538 }
539  
540 sub datecontentcolor {
541 0 ▶ my $self = shift;
Subroutine datecontentcolor: not called CC=5 SCAR=34.0
Pod documented
542 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
543 0 my $newvalue = shift;
544  
545 0 ▶ if (defined($newvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
546 0 foreach my $date (@dates) {
547 0 ▶ $self->{'datecontentcolor'}->{$date} = $newvalue if defined($self->{'datecontentcolor'}->{$date});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"datecontentcolor"}{$date} 0 0 0
548 }
549 }
550  
551 0 return $self->{'datecontentcolor'}->{$dates[0]};
552 }
553  
554 sub highlight {
555 0 ▶ my $self=shift;
Subroutine highlight: not called CC=2 SCAR=17.9
Pod documented
556 0 my @day=@_;
557 0 foreach my $day (@day) {
558 0 $self->datebordercolor($day, $self->highlightbordercolor);
559 0 $self->datecolor($day, $self->highlightcontentcolor);
560 }
561 0 return(1);
562 }
563  
564 sub getcontent {
565 0 ▶ my $self = shift;
Subroutine getcontent: not called CC=2 SCAR=17.9
Pod documented
566 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
567 0 return $self->{'content'}->{$dates[0]};
568 }
569  
570 sub setcontent {
571 0 ▶ my $self = shift;
Subroutine setcontent: not called CC=5 SCAR=34.0
Pod documented
572 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
573 0 ▶ my $newcontent = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
574  
575 0 foreach my $date (@dates) {
576 0 ▶ $self->{'content'}->{$date} = $newcontent if defined($self->{'content'}->{$date});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"content"}{$date} 0 0 0
577 }
578  
579 0 return(1);
580 }
581  
582 sub addcontent {
583 0 ▶ my $self = shift;
Subroutine addcontent: not called CC=5 SCAR=34.0
Pod documented
584 0 ▶ my @dates = $self->_date_string_to_numeric(shift); return() unless @dates;
Branch: 1 branch
BranchTrueFalseTotal
unless @dates 0 0 0
585 0 ▶ my $newcontent = shift || return();
Condition0%0/2
shift() || (return ())
l!l
00
MC/DC0%0/1
shift() || (return ())
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
586  
587 0 foreach my $date (@dates) {
588 0 ▶ $self->{'content'}->{$date} .= $newcontent if defined($self->{'content'}->{$date});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"content"}{$date} 0 0 0
589 }
590  
591 0 return(1);
592 }
593  
594 sub border {
595 0 ▶ my $self = shift;
Subroutine border: not called CC=2 SCAR=17.9
Pod documented
596 0 my $newvalue = shift;
597 0 ▶ if (defined($newvalue)) { $self->{'border'} = int($newvalue); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
598 0 return $self->{'border'};
599 }
600  
601  
602 sub cellpadding {
603 0 ▶ my $self = shift;
Subroutine cellpadding: not called CC=2 SCAR=17.9
Pod documented
604 0 my $newvalue = shift;
605 0 ▶ if (defined($newvalue)) { $self->{'cellpadding'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
606 0 return $self->{'cellpadding'};
607 }
608  
609 sub cellspacing {
610 0 ▶ my $self = shift;
Subroutine cellspacing: not called CC=2 SCAR=17.9
Pod documented
611 0 my $newvalue = shift;
612 0 ▶ if (defined($newvalue)) { $self->{'cellspacing'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
613 0 return $self->{'cellspacing'};
614 }
615  
616 sub width {
617 0 ▶ my $self = shift;
Subroutine width: not called CC=2 SCAR=17.9
Pod documented
618 0 my $newvalue = shift;
619 0 ▶ if (defined($newvalue)) { $self->{'width'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
620 0 return $self->{'width'};
621 }
622  
623 sub showdatenumbers {
624 0 ▶ my $self = shift;
Subroutine showdatenumbers: not called CC=2 SCAR=17.9
Pod documented
625 0 my $newvalue = shift;
626 0 ▶ if (defined($newvalue)) { $self->{'showdatenumbers'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
627 0 return $self->{'showdatenumbers'};
628 }
629 sub showweekdayheaders {
630 0 ▶ my $self = shift;
Subroutine showweekdayheaders: not called CC=2 SCAR=17.9
Pod documented
631 0 my $newvalue = shift;
632 0 ▶ if (defined($newvalue)) { $self->{'showweekdayheaders'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
633 0 return $self->{'showweekdayheaders'};
634 }
635  
636 sub cellalignment {
637 0 ▶ my $self = shift;
Subroutine cellalignment: not called CC=2 SCAR=17.9
Pod documented
638 0 my $newvalue = shift;
639 0 ▶ if (defined($newvalue)) { $self->{'cellalignment'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
640 0 return $self->{'cellalignment'};
641 }
642  
643 sub vcellalignment {
644 0 ▶ my $self = shift;
Subroutine vcellalignment: not called CC=2 SCAR=17.9
Pod documented
645 0 my $newvalue = shift;
646 0 ▶ if (defined($newvalue)) { $self->{'vcellalignment'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
647 0 return $self->{'vcellalignment'};
648 }
649  
650 sub contentfontsize {
651 0 ▶ my $self = shift;
Subroutine contentfontsize: not called CC=2 SCAR=17.9
Pod documented
652 0 my $newvalue = shift;
653 0 ▶ if (defined($newvalue)) { $self->{'contentfontsize'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
654 0 return $self->{'contentfontsize'};
655 }
656  
657 sub weekdayheadersbig {
658 0 ▶ my $self = shift;
Subroutine weekdayheadersbig: not called CC=2 SCAR=17.9
Pod documented
659 0 my $newvalue = shift;
660 0 ▶ if (defined($newvalue)) { $self->{'weekdayheadersbig'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
661 0 return $self->{'weekdayheadersbig'};
662 }
663  
664 sub year {
665 3 ▶ my $self = shift;
Subroutine year: called CC=1 SCAR=0.0
Pod documented
666 3 return $self->{'year'};
667 }
668  
669 sub month {
670 3 ▶ my $self = shift;
Subroutine month: called CC=1 SCAR=0.0
Pod documented
671 3 return $self->{'month'};
672 }
673  
674 sub monthname {
675 0 ▶ my $self = shift;
Subroutine monthname: not called CC=1 SCAR=6.9
Pod documented
676 0 return $self->{'monthname'};
677 }
678  
679 sub today_year {
680 0 ▶ my $self = shift;
Subroutine today_year: not called CC=1 SCAR=6.9
Pod documented
681 0 return $self->{'today_year'};
682 }
683  
684 sub today_month {
685 0 ▶ my $self = shift;
Subroutine today_month: not called CC=1 SCAR=6.9
Pod documented
686 0 return $self->{'today_month'};
687 }
688  
689 sub today_date {
690 0 ▶ my $self = shift;
Subroutine today_date: not called CC=1 SCAR=6.9
Pod documented
691 0 return $self->{'today_date'};
692 }
693  
694  
695 sub header {
696 0 ▶ my $self = shift;
Subroutine header: not called CC=2 SCAR=17.9
Pod documented
697 0 my $newvalue = shift;
698 0 ▶ if (defined($newvalue)) { $self->{'header'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
699 0 return $self->{'header'};
700 }
701  
702 sub nowrap {
703 0 ▶ my $self = shift;
Subroutine nowrap: not called CC=2 SCAR=17.9
Pod documented
704 0 my $newvalue = shift;
705 0 ▶ if (defined($newvalue)) { $self->{'nowrap'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
706 0 return $self->{'nowrap'};
707 }
708  
709 sub sharpborders {
710 0 ▶ my $self = shift;
Subroutine sharpborders: not called CC=2 SCAR=17.9
Pod documented
711 0 my $newvalue = shift;
712 0 ▶ if (defined($newvalue)) { $self->{'sharpborders'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
713 0 return $self->{'sharpborders'};
714 }
715  
716 sub cellheight {
717 0 ▶ my $self = shift;
Subroutine cellheight: not called CC=2 SCAR=17.9
Pod documented
718 0 my $newvalue = shift;
719 0 ▶ if (defined($newvalue)) { $self->{'cellheight'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
720 0 return $self->{'cellheight'};
721 }
722  
723 sub cellclass {
724 0 ▶ my $self = shift;
Subroutine cellclass: not called CC=2 SCAR=17.9
Pod documented
725 0 my $newvalue = shift;
726 0 ▶ if (defined($newvalue)) { $self->{'cellclass'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
727 0 return $self->{'cellclass'};
728 }
729  
730 sub tableclass {
731 0 ▶ my $self = shift;
Subroutine tableclass: not called CC=2 SCAR=17.9
Pod documented
732 0 my $newvalue = shift;
733 0 ▶ if (defined($newvalue)) { $self->{'tableclass'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
734 0 return $self->{'tableclass'};
735 }
736  
737 sub weekdaycellclass {
738 0 ▶ my $self = shift;
Subroutine weekdaycellclass: not called CC=2 SCAR=17.9
Pod documented
739 0 my $newvalue = shift;
740 0 ▶ if (defined($newvalue)) { $self->{'weekdaycellclass'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
741 0 return $self->{'weekdaycellclass'};
742 }
743  
744 sub weekendcellclass {
745 0 ▶ my $self = shift;
Subroutine weekendcellclass: not called CC=2 SCAR=17.9
Pod documented
746 0 my $newvalue = shift;
747 0 ▶ if (defined($newvalue)) { $self->{'weekendcellclass'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
748 0 return $self->{'weekendcellclass'};
749 }
750  
751 sub todaycellclass {
752 0 ▶ my $self = shift;
Subroutine todaycellclass: not called CC=2 SCAR=17.9
Pod documented
753 0 my $newvalue = shift;
754 0 ▶ if (defined($newvalue)) { $self->{'todaycellclass'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
755 0 return $self->{'todaycellclass'};
756 }
757  
758 sub datecellclass {
759 0 ▶ my $self = shift;
Subroutine datecellclass: not called CC=4 SCAR=30.0
Pod documented
760 0 ▶ my $date = lc(shift) || return(); $date = int($date) if $date =~ m/^[\d\.]+$/;
Branch: 1 branch
BranchTrueFalseTotal
if $date =~ /^[\d\.]+$/ 0 0 0
Condition0%0/2
lc shift() || (return ())
l!l
00
MC/DC0%0/1
lc shift() || (return ())
lc shift()
Truth table0%0/2
A
A= lc shift()
Aresult
11
00
761 0 my $newvalue = shift;
762 0 ▶ if (defined($newvalue)) { $self->{'datecellclass'}->{$date} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
763 0 return $self->{'datecellclass'}->{$date};
764 }
765  
766 sub headerclass {
767 0 ▶ my $self = shift;
Subroutine headerclass: not called CC=2 SCAR=17.9
Pod documented
768 0 my $newvalue = shift;
769 0 ▶ if (defined($newvalue)) { $self->{'headerclass'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
770 0 return $self->{'headerclass'};
771 }
772  
773 sub weekstartsonmonday {
774 0 ▶ my $self = shift;
Subroutine weekstartsonmonday: not called CC=3 SCAR=24.8
Pod documented
775 0 my $newvalue = shift;
776 0 ▶ if (defined($newvalue)) { $self->{'weekstartsonmonday'} = $newvalue; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newvalue) 0 0 0
777 0 ▶ return $self->{'weekstartsonmonday'} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'weekstartsonmonday'} ? : 0 0 0
778 }
779  
780 sub Days_in_Month {
781 3 ▶ my $self=shift;
Subroutine Days_in_Month: called CC=1 SCAR=0.0
Pod documented
782 3 return Date::Calc::Days_in_Month($self->year, $self->month);
783 }
784  
785 ### the following methods are internal-use-only methods
786  
787 # _date_string_to_numeric() takes a date string (e.g. 5, 'wednesdays', or '3friday')
788 # and returns the corresponding numeric date. For numerics, this sounds meaningless,
789 # but for the strings it's useful to have this all in one place.
790 # If it's a plural weekday (e.g. 'sundays') then an array of numeric dates is returned.
791 sub _date_string_to_numeric {
792 0 ▶ my $self = shift;
Subroutine _date_string_to_numeric: not called CC=7 SCAR=40.3
793 0 ▶ my $date = shift || return ();
Condition0%0/2
shift() || (return ())
l!l
00
MC/DC0%0/1
shift() || (return ())
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
794  
795 0 my($which,$weekday);
796 0 ▶ if ($date =~ m/^\d\.*\d*$/) { # first and easiest, simple numerics
Branch: 3 branches
BranchTrueFalseTotal
if ($date =~ /^\d\.*\d*$/) { } 0 0 0
elsif (() = $date =~ /^(\d)([a-zA-Z]+)$/) { } 0 0 0
elsif (($weekday) = $date =~ /^(\w+)s$/i) { } 0 0 0
797 0 return int($date);
798 }
799 elsif (($which,$weekday) = ($date =~ m/^(\d)([a-zA-Z]+)$/)) {
800 0 my($y,$m,$d) = Date::Calc::Nth_Weekday_of_Month_Year($self->year(),$self->month(),Date::Calc::Decode_Day_of_Week($weekday),$which);
801 0 return $d;
802 }
803 elsif (($weekday) = ($date =~ m/^(\w+)s$/i)) {
804 0 $weekday = Date::Calc::Decode_Day_of_Week($weekday); # now it's the numeric weekday
805 0 my @dates;
806 0 foreach my $which (1..5) {
807 0 my $thisdate = Date::Calc::Nth_Weekday_of_Month_Year($self->year(),$self->month(),$weekday,$which);
808 0 ▶ push(@dates,$thisdate) if $thisdate;
Branch: 1 branch
BranchTrueFalseTotal
if $thisdate 0 0 0
809 }
810 0 return @dates;
811 }
812 }
813  
814  
815  
816 __END__;
↑ Summary