Calc/Object.pm

filter: Statementstmt 72.1% 643 / 891 Branchbran 67.7% 363 / 536 Conditioncond 54.6% 218 / 399 MC/DCmcdc 29.8% 59 / 198 Subroutinesub 84.8% 56 / 66 Podpod 0.0% 0 / 40 totaltotal 62.8% 1339 / 2130 CC 412 SCAR 38.5
CC
412
Cov
67%
is_valid
159.4
_process_
112.8
string
74.9
CRAP 47.0
« Calc/PP.pm ↑ Summary Calendar/Year.pm »
1  
2 ###############################################################################
3 ## ##
4 ## Copyright (c) 2000 - 2015 by Steffen Beyer. ##
5 ## All rights reserved. ##
6 ## ##
7 ## This package is free software; you can redistribute it ##
8 ## and/or modify it under the same terms as Perl itself. ##
9 ## ##
10 ###############################################################################
11  
12 ###############################################################################
13 ## ##
14 ## Mottos of this module: ##
15 ## ##
16 ## 1) Small is beautiful. ##
17 ## ##
18 ## 2) Make frequent things easy and infrequent or hard things possible. ##
19 ## ##
20 ###############################################################################
21  
22 package Date::Calc::Object;
23  
24 15 ▶BEGIN { eval { require bytes; }; }
Subroutine BEGIN: called CC=1 SCAR=0.0
25 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 15 ▶use vars qw(@ISA @AUXILIARY @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 15 ▶use Carp::Clan qw(^Date::);
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 BEGIN # Re-export imports from Date::Calc:
31 15 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
32 15 require Exporter;
33 15 require Date::Calc;
34 15 @ISA = qw(Exporter Date::Calc);
35 15 @AUXILIARY = qw(shift_year shift_date shift_time shift_datetime);
36 15 @EXPORT = @Date::Calc::EXPORT;
37 15 @EXPORT_OK = (@Date::Calc::EXPORT_OK,@AUXILIARY);
38 15 %EXPORT_TAGS = (all => [@Date::Calc::EXPORT_OK],
39 aux => [@AUXILIARY],
40 ALL => [@EXPORT_OK]);
41 15 $VERSION = '6.4';
42 15 Date::Calc->import(@Date::Calc::EXPORT,@Date::Calc::EXPORT_OK);
43 }
44  
45 sub shift_year
46 1239 ▶{
Subroutine shift_year: called CC=7 SCAR=19.5
Pod undocumented
47 1239 ▶ croak("internal error - parameter is not an ARRAY ref") if (ref($_[0]) ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] ne "ARRAY" 1 1238 1239
48  
49 1238 ▶ if (ref($_[0][0]))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0][0]) { } 195 1043 1238
50 {
51 195 ▶ if (ref($_[0][0]) eq 'ARRAY')
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0][0] eq 'ARRAY') { } 6 189 195
elsif (ref($_[0][0]) =~ /[^:]::[^:]/) { } 188 1 189
52 {
53 6 ▶ if (@{$_[0][0]} == 3) # otherwise anonymous array is pointless
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0][0];} == 3) { } 1 5 6
54 {
55 1 return ${shift(@{$_[0]})}[0];
56 }
57 else
58 {
59 5 croak("wrong number of elements in date constant");
60 }
61 }
62 elsif (ref($_[0][0]) =~ /[^:]::[^:]/)
63 {
64 188 return shift(@{$_[0]})->year();
65 }
66 else
67 {
68 1 croak("input parameter is neither ARRAY ref nor object");
69 }
70 }
71 else
72 {
73 1043 ▶ if (@{$_[0]} >= 1)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0];} >= 1) { } 1042 1 1043
74 {
75 1042 return shift(@{$_[0]});
76 }
77 else
78 {
79 1 croak("not enough input parameters for a year");
80 }
81 }
82 }
83  
84 sub shift_date
85 23848 ▶{
Subroutine shift_date: called CC=7 SCAR=19.5
Pod undocumented
86 23848 ▶ croak("internal error - parameter is not an ARRAY ref") if (ref($_[0]) ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] ne "ARRAY" 1 23847 23848
87  
88 23847 ▶ if (ref($_[0][0]))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0][0]) { } 48 23799 23847
89 {
90 48 ▶ if (ref($_[0][0]) eq 'ARRAY')
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0][0] eq 'ARRAY') { } 34 14 48
elsif (ref($_[0][0]) =~ /[^:]::[^:]/) { } 13 1 14
91 {
92 34 ▶ if (@{$_[0][0]} == 3)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0][0];} == 3) { } 28 6 34
93 {
94 28 return( @{shift(@{$_[0]})} );
95 }
96 else
97 {
98 6 croak("wrong number of elements in date constant");
99 }
100 }
101 elsif (ref($_[0][0]) =~ /[^:]::[^:]/)
102 {
103 13 return( shift(@{$_[0]})->date() );
104 }
105 else
106 {
107 1 croak("input parameter is neither ARRAY ref nor object");
108 }
109 }
110 else
111 {
112 23799 ▶ if (@{$_[0]} >= 3)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0];} >= 3) { } 23796 3 23799
113 {
114 23796 return( shift(@{$_[0]}), shift(@{$_[0]}), shift(@{$_[0]}) );
115 }
116 else
117 {
118 3 croak("not enough input parameters for a date");
119 }
120 }
121 }
122  
123 sub shift_time
124 20 ▶{
Subroutine shift_time: called CC=7 SCAR=19.5
Pod undocumented
125 20 ▶ croak("internal error - parameter is not an ARRAY ref") if (ref($_[0]) ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] ne "ARRAY" 1 19 20
126  
127 19 ▶ if (ref($_[0][0]))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0][0]) { } 12 7 19
128 {
129 12 ▶ if (ref($_[0][0]) eq 'ARRAY')
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0][0] eq 'ARRAY') { } 7 5 12
elsif (ref($_[0][0]) =~ /[^:]::[^:]/) { } 4 1 5
130 {
131 7 ▶ if (@{$_[0][0]} == 3)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0][0];} == 3) { } 1 6 7
132 {
133 1 return( @{shift(@{$_[0]})} );
134 }
135 else
136 {
137 6 croak("wrong number of elements in time constant");
138 }
139 }
140 elsif (ref($_[0][0]) =~ /[^:]::[^:]/)
141 {
142 4 return( (shift(@{$_[0]})->datetime())[3,4,5] );
143 }
144 else
145 {
146 1 croak("input parameter is neither ARRAY ref nor object");
147 }
148 }
149 else
150 {
151 7 ▶ if (@{$_[0]} >= 3)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0];} >= 3) { } 4 3 7
152 {
153 4 return( shift(@{$_[0]}), shift(@{$_[0]}), shift(@{$_[0]}) );
154 }
155 else
156 {
157 3 croak("not enough input parameters for time values");
158 }
159 }
160 }
161  
162 sub shift_datetime
163 26 ▶{
Subroutine shift_datetime: called CC=7 SCAR=19.5
Pod undocumented
164 26 ▶ croak("internal error - parameter is not an ARRAY ref") if (ref($_[0]) ne 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[0] ne "ARRAY" 1 25 26
165  
166 25 ▶ if (ref($_[0][0]))
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0][0]) { } 15 10 25
167 {
168 15 ▶ if (ref($_[0][0]) eq 'ARRAY')
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0][0] eq 'ARRAY') { } 10 5 15
elsif (ref($_[0][0]) =~ /[^:]::[^:]/) { } 4 1 5
169 {
170 10 ▶ if (@{$_[0][0]} == 6)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0][0];} == 6) { } 1 9 10
171 {
172 1 return( @{shift(@{$_[0]})} );
173 }
174 else
175 {
176 9 croak("wrong number of elements in date-time constant");
177 }
178 }
179 elsif (ref($_[0][0]) =~ /[^:]::[^:]/)
180 {
181 4 return( shift(@{$_[0]})->datetime() );
182 }
183 else
184 {
185 1 croak("input parameter is neither ARRAY ref nor object");
186 }
187 }
188 else
189 {
190 10 ▶ if (@{$_[0]} >= 6)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$_[0];} >= 6) { } 4 6 10
191 {
192 4 return( shift(@{$_[0]}), shift(@{$_[0]}), shift(@{$_[0]}),
193 4 shift(@{$_[0]}), shift(@{$_[0]}), shift(@{$_[0]}) );
194 }
195 else
196 {
197 6 croak("not enough input parameters for a date and time");
198 }
199 }
200 }
201  
202 package Date::Calc;
203  
204 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
205  
206 15 ▶use Carp::Clan qw(^Date::);
Subroutine BEGIN: called CC=1 SCAR=0.0
207  
208 use overload
209 15 ▶ '0+' => 'number',
Subroutine BEGIN: called CC=1 SCAR=0.0
210 '""' => 'string',
211 'bool' => 'is_valid',
212 'neg' => '_unary_minus_',
213 'abs' => 'number',
214 '<=>' => '_compare_date_',
215 'cmp' => '_compare_date_time_',
216 '==' => '_equal_date_',
217 '!=' => '_not_equal_date_',
218 'eq' => '_equal_date_time_',
219 'ne' => '_not_equal_date_time_',
220 '+' => '_plus_',
221 '-' => '_minus_',
222 '+=' => '_plus_equal_',
223 '-=' => '_minus_equal_',
224 '++' => '_increment_',
225 '--' => '_decrement_',
226 'x' => '_times_',
227 'x=' => '_times_equal_',
228 '=' => 'clone',
229 'nomethod' => 'OVERLOAD', # equivalent of AUTOLOAD ;-)
230 15 'fallback' => undef;
231  
232 # Report unimplemented overloaded operators:
233  
234 sub OVERLOAD
235 8 ▶{
Subroutine OVERLOAD: called CC=1 SCAR=0.0
Pod undocumented
236 8 croak("operator '$_[3]' is unimplemented");
237 }
238  
239 # Prevent nearly infinite loops:
240  
241 sub _times_
242 1 ▶{
Subroutine _times_: called CC=1 SCAR=0.0
243 1 $_[3] = 'x';
244 1 goto &OVERLOAD;
245 }
246  
247 sub _times_equal_
248 1 ▶{
Subroutine _times_equal_: called CC=1 SCAR=0.0
249 1 $_[3] = 'x=';
250 1 goto &OVERLOAD;
251 }
252  
253 15 my $ACCURATE_MODE = 1;
254 15 my $NORMALIZED_MODE = 0; # disabled by default for backward compatibility
255 15 my $NUMBER_FORMAT = 0;
256 15 my $DELTA_FORMAT = 0;
257 15 my $DATE_FORMAT = 0;
258  
259 sub accurate_mode
260 22 ▶{
Subroutine accurate_mode: called CC=3 SCAR=11.0
Pod undocumented
261 22 my($flag) = $ACCURATE_MODE;
262  
263 22 ▶ if (@_ > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1) 22 0 22
264 {
265 22 ▶ $ACCURATE_MODE = $_[1] || 0;
Condition100%2/2
$_[1] || 0
l!l
913
MC/DC100%1/1
$_[1] || 0
$_[1]
Truth table100%2/2
A
A= $_[1]
Aresult
11
00
266 }
267 22 return $flag;
268 }
269  
270 sub normalized_mode
271 2 ▶{
Subroutine normalized_mode: called CC=3 SCAR=11.4
Pod undocumented
272 2 my($flag) = $NORMALIZED_MODE;
273  
274 2 ▶ if (@_ > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1) 2 0 2
275 {
276 2 ▶ $NORMALIZED_MODE = $_[1] || 0;
Condition50%1/2
$_[1] || 0
l!l
20
MC/DC0%0/1
$_[1] || 0
$_[1]
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
277 }
278 2 return $flag;
279 }
280  
281 sub number_format
282 0 ▶{
Subroutine number_format: not called CC=3 SCAR=24.8
Pod undocumented
283 0 my($flag) = $NUMBER_FORMAT;
284  
285 0 ▶ if (@_ > 1)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 1) 0 0 0
286 {
287 0 ▶ $NUMBER_FORMAT = $_[1] || 0;
Condition0%0/2
$_[1] || 0
l!l
00
MC/DC0%0/1
$_[1] || 0
$_[1]
Truth table0%0/2
A
A= $_[1]
Aresult
11
00
288 }
289 0 return $flag;
290 }
291  
292 sub delta_format
293 8 ▶{
Subroutine delta_format: called CC=7 SCAR=20.2
Pod undocumented
294 8 my($self) = shift;
295 8 my($flag);
296  
297 8 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 4 4 8
298 {
299 4 ▶ $flag = defined($self->[0][1]) ? $self->[0][1] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[0][1] ? : 0 4 4
300 4 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 4 0 4
301 {
302 4 ▶ $self->[0][1] = defined($_[0]) ? $_[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 4 0 4
303 }
304 }
305 else # class method
306 {
307 4 $flag = $DELTA_FORMAT;
308 4 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 4 0 4
309 {
310 4 ▶ $DELTA_FORMAT = $_[0] || 0;
Condition50%1/2
$_[0] || 0
l!l
40
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
311 }
312 }
313 8 return $flag;
314 }
315  
316 sub date_format
317 13 ▶{
Subroutine date_format: called CC=7 SCAR=20.2
Pod undocumented
318 13 my($self) = shift;
319 13 my($flag);
320  
321 13 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 6 7 13
322 {
323 6 ▶ $flag = defined($self->[0][2]) ? $self->[0][2] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[0][2] ? : 0 6 6
324 6 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 6 0 6
325 {
326 6 ▶ $self->[0][2] = defined($_[0]) ? $_[0] : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 6 0 6
327 }
328 }
329 else # class method
330 {
331 7 $flag = $DATE_FORMAT;
332 7 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 7 0 7
333 {
334 7 ▶ $DATE_FORMAT = $_[0] || 0;
Condition50%1/2
$_[0] || 0
l!l
70
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
335 }
336 }
337 13 return $flag;
338 }
339  
340 sub language
341 14 ▶{
Subroutine language: called CC=13 SCAR=26.5
Pod undocumented
342 14 my($self) = shift;
343 14 my($lang,$temp);
344  
345 eval
346 14 {
347 14 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 9 5 14
348 {
349 9 ▶ $lang = defined($self->[0][3]) ? Language_to_Text($self->[0][3]) : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $self->[0][3] ? : 4 5 9
350 8 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 5 3 8
351 {
352 5 ▶ if (defined $_[0])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) { } 5 0 5
353 {
354 5 $temp = $_[0];
355 5 ▶ if ($temp !~ /^\d+$/)
Branch: 1 branch
BranchTrueFalseTotal
unless ($temp =~ /^\d+$/) 4 1 5
356 4 { $temp = Decode_Language($temp); }
357 5 ▶ if ($temp >= 1 and $temp <= Languages())
Branch: 1 branch
BranchTrueFalseTotal
if ($temp >= 1 and $temp <= Languages()) { } 5 0 5
Condition33%1/3
$temp >= 1 and $temp <= Languages()
!ll&&!rl&&r
005
MC/DC0%0/2
$temp >= 1 and $temp <= Languages()
$temp >= 1 $temp <= Languages()
Truth table33%1/3
A and B
A= $temp >= 1B= $temp <= Languages()
ABresult
0X0
100
111
358 5 { $self->[0][3] = $temp; }
359 else
360 0 { croak "no such language '$_[0]'"; }
361 }
362 0 else { $self->[0][3] = undef; }
363 }
364 }
365 else # class method
366 {
367 5 $lang = Language_to_Text(Language());
368 5 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 3 2 5
369 {
370 3 $temp = $_[0];
371 3 ▶ if ($temp !~ /^\d+$/)
Branch: 1 branch
BranchTrueFalseTotal
unless ($temp =~ /^\d+$/) 1 2 3
372 1 { $temp = Decode_Language($temp); }
373 3 ▶ if ($temp >= 1 and $temp <= Languages())
Branch: 1 branch
BranchTrueFalseTotal
if ($temp >= 1 and $temp <= Languages()) { } 3 0 3
Condition33%1/3
$temp >= 1 and $temp <= Languages()
!ll&&!rl&&r
003
MC/DC0%0/2
$temp >= 1 and $temp <= Languages()
$temp >= 1 $temp <= Languages()
Truth table33%1/3
A and B
A= $temp >= 1B= $temp <= Languages()
ABresult
0X0
100
111
374 3 { Language($temp); }
375 else
376 0 { croak "no such language '$_[0]'"; }
377 }
378 }
379 };
380 14 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 13 14
381 {
382 1 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
383 1 $@ =~ s!\s+at\s+\S.*\s*$!!;
384 1 croak($@);
385 }
386 13 return $lang;
387 }
388  
389 sub is_delta
390 61 ▶{
Subroutine is_delta: called CC=6 SCAR=19.2
Pod undocumented
391 61 my($self) = @_;
392 61 my($bool) = undef;
393  
394 eval
395 61 {
396 61 ▶ if (defined($self->[0]) and
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[0] and ref $self->[0] eq "ARRAY" and defined $self->[0][0]) 60 1 61
Condition50%3/6
defined $self->[0] and ref $self->[0] eq "ARRAY" and defined $self->[0][0]
!ll&&!rl&&r
0160
defined $self->[0] and ref $self->[0] eq "ARRAY"
!ll&&!rl&&r
0061
MC/DC33%1/3
defined $self->[0] and ref $self->[0] eq "ARRAY" and defined $self->[0][0]
defined $self->[0] ref $self->[0] eq "ARRAY" defined $self->[0][0]
Truth table50%2/4
A and B and C
A= defined $self->[0]B= ref $self->[0] eq "ARRAY"C= defined $self->[0][0]
ABCresult
0XX0
10X0
1100
1111
397 ref($self->[0]) eq 'ARRAY' and
398 defined($self->[0][0]))
399 60 ▶ { $bool = ($self->[0][0] ? 1 : 0); }
Branch: 1 branch
BranchTrueFalseTotal
$self->[0][0] ? : 16 44 60
400 };
401 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 61 61
402 61 return $bool;
403 }
404  
405 sub is_date
406 927 ▶{
Subroutine is_date: called CC=6 SCAR=19.2
Pod undocumented
407 927 my($self) = @_;
408 927 my($bool) = undef;
409  
410 eval
411 927 {
412 927 ▶ if (defined($self->[0]) and
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[0] and ref $self->[0] eq "ARRAY" and defined $self->[0][0]) 926 1 927
Condition50%3/6
defined $self->[0] and ref $self->[0] eq "ARRAY" and defined $self->[0][0]
!ll&&!rl&&r
01926
defined $self->[0] and ref $self->[0] eq "ARRAY"
!ll&&!rl&&r
00927
MC/DC33%1/3
defined $self->[0] and ref $self->[0] eq "ARRAY" and defined $self->[0][0]
defined $self->[0] ref $self->[0] eq "ARRAY" defined $self->[0][0]
Truth table50%2/4
A and B and C
A= defined $self->[0]B= ref $self->[0] eq "ARRAY"C= defined $self->[0][0]
ABCresult
0XX0
10X0
1100
1111
413 ref($self->[0]) eq 'ARRAY' and
414 defined($self->[0][0]))
415 926 ▶ { $bool = ($self->[0][0] ? 0 : 1); }
Branch: 1 branch
BranchTrueFalseTotal
$self->[0][0] ? : 322 604 926
416 };
417 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 927 927
418 927 return $bool;
419 }
420  
421 sub is_short
422 0 ▶{
Subroutine is_short: not called CC=4 SCAR=30.0
Pod undocumented
423 0 my($self) = @_;
424 0 my($bool) = undef;
425  
426 eval
427 0 {
428 0 ▶ if (@{$self} == 4) { $bool = 1; }
Branch: 2 branches
BranchTrueFalseTotal
if (@{$self;} == 4) { } 0 0 0
elsif (@{$self;} == 7) { } 0 0 0
429 0 elsif (@{$self} == 7) { $bool = 0; }
430 };
431 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
432 0 return $bool;
433 }
434  
435 sub is_long
436 518 ▶{
Subroutine is_long: called CC=4 SCAR=14.3
Pod undocumented
437 518 my($self) = @_;
438 518 my($bool) = undef;
439  
440 eval
441 518 {
442 518 ▶ if (@{$self} == 7) { $bool = 1; }
Branch: 2 branches
BranchTrueFalseTotal
if (@{$self;} == 7) { } 205 313 518
elsif (@{$self;} == 4) { } 313 0 313
443 313 elsif (@{$self} == 4) { $bool = 0; }
444 };
445 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 518 518
446 518 return $bool;
447 }
448  
449 sub is_valid
450 1275 ▶{
Subroutine is_valid: called CC=40 SCAR=50.7
Pod undocumented
451 1275 my($self) = @_;
452 1275 my($bool);
453  
454 $bool = eval
455 1275 {
456 1275 ▶ if (defined($self->[0]) and
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0 and defined $self->[0][0] and not ref $self->[0][0] and $self->[0][0] == 0 || $self->[0][0] == 1 and @{$self;} == 4 || @{$self;} == 7) 1272 3 1275
Condition66%12/18
defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0 and defined $self->[0][0] and not ref $self->[0][0] and $self->[0][0] == 0 || $self->[0][0] == 1 and @{$self;} == 4 || @{$self;} == 7
!ll&&!rl&&r
121272
defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0 and defined $self->[0][0] and not ref $self->[0][0] and $self->[0][0] == 0 || $self->[0][0] == 1
!ll&&!rl&&r
101274
defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0 and defined $self->[0][0] and not ref $self->[0][0]
!ll&&!rl&&r
101274
defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0 and defined $self->[0][0]
!ll&&!rl&&r
101274
defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0
!ll&&!rl&&r
011274
defined $self->[0] and ref $self->[0] eq "ARRAY"
!ll&&!rl&&r
001275
MC/DC0%0/7
defined $self->[0] and ref $self->[0] eq "ARRAY" and @{$self->[0];} > 0 and defined $self->[0][0] and not ref $self->[0][0] and $self->[0][0] == 0 || $self->[0][0] == 1 and @{$self;} == 4 || @{$self;} == 7
defined $self->[0] ref $self->[0] eq "ARRAY" @{$self->[0];} > 0 defined $self->[0][0] not ref $self->[0][0] $self->[0][0] == 0 || $self->[0][0] == 1 @{$self;} == 4 || @{$self;} == 7
Truth table12%1/8
A and B and C and D and not(E) and F and G
A= defined $self->[0]B= ref $self->[0] eq "ARRAY"C= @{$self->[0];} > 0D= defined $self->[0][0]E= not ref $self->[0][0]F= $self->[0][0] == 0 || $self->[0][0] == 1G= @{$self;} == 4 || @{$self;} == 7
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
457 ref($self->[0]) eq 'ARRAY' and
458 1275 ▶ @{$self->[0]} > 0 and
Condition83%5/6
$self->[0][0] == 0 or $self->[0][0] == 1
l!l&&r!l&&!r
8524220
@{$self;} == 4 or @{$self;} == 7
l!l&&r!l&&!r
7485242
MC/DC0%0/2
$self->[0][0] == 0 or $self->[0][0] == 1
$self->[0][0] == 0 $self->[0][0] == 1
MC/DC100%2/2
@{$self;} == 4 or @{$self;} == 7
@{$self;} == 4 @{$self;} == 7
Truth table66%2/3
A or B
A= $self->[0][0] == 0B= $self->[0][0] == 1
ABresult
1X1
011
000
Truth table100%3/3
A or B
A= @{$self;} == 4B= @{$self;} == 7
ABresult
1X1
011
000
459 defined($self->[0][0]) and
460 not ref($self->[0][0]) and
461 ($self->[0][0] == 0 or $self->[0][0] == 1) and
462 1274 (@{$self} == 4 or @{$self} == 7))
463 {
464 1272 ▶ if ($self->[0][0]) # is_delta
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0][0]) { } 421 851 1272
465 {
466 421 ▶ return 0 unless
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3] 0 421 421
Condition33%5/15
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3]
!ll&&!rl&&r
00421
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3]
!ll&&!rl&&r
00421
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2]
!ll&&!rl&&r
00421
defined $self->[1] and not ref $self->[1] and defined $self->[2]
!ll&&!rl&&r
00421
defined $self->[1] and not ref $self->[1]
!ll&&!rl&&r
00421
MC/DC0%0/6
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3]
defined $self->[1] not ref $self->[1] defined $self->[2] not ref $self->[2] defined $self->[3] not ref $self->[3]
Truth table14%1/7
A and not(B) and C and not(D) and E and not(F)
A= defined $self->[1]B= not ref $self->[1]C= defined $self->[2]D= not ref $self->[2]E= defined $self->[3]F= not ref $self->[3]
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
467 (
468 defined($self->[1]) and not ref($self->[1]) and
469 defined($self->[2]) and not ref($self->[2]) and
470 defined($self->[3]) and not ref($self->[3])
471 );
472 421 ▶ if (@{$self} > 4) # is_long
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} > 4) 210 211 421
473 {
474 210 ▶ return 0 unless
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6] 0 210 210
Condition33%5/15
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6]
!ll&&!rl&&r
00210
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6]
!ll&&!rl&&r
00210
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5]
!ll&&!rl&&r
00210
defined $self->[4] and not ref $self->[4] and defined $self->[5]
!ll&&!rl&&r
00210
defined $self->[4] and not ref $self->[4]
!ll&&!rl&&r
00210
MC/DC0%0/6
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6]
defined $self->[4] not ref $self->[4] defined $self->[5] not ref $self->[5] defined $self->[6] not ref $self->[6]
Truth table14%1/7
A and not(B) and C and not(D) and E and not(F)
A= defined $self->[4]B= not ref $self->[4]C= defined $self->[5]D= not ref $self->[5]E= defined $self->[6]F= not ref $self->[6]
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
475 (
476 defined($self->[4]) and not ref($self->[4]) and
477 defined($self->[5]) and not ref($self->[5]) and
478 defined($self->[6]) and not ref($self->[6])
479 );
480 }
481 421 return 1;
482 }
483 else # is_date
484 {
485 return 0 unless
486 (
487 defined($self->[1]) and not ref($self->[1]) and
488 defined($self->[2]) and not ref($self->[2]) and
489 defined($self->[3]) and not ref($self->[3]) and
490 851 ▶ check_date(@{$self}[1..3])
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3] and check_date(@{$self;}[1..3]) 3 848 851
Condition38%7/18
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3] and check_date(@{$self;}[1..3])
!ll&&!rl&&r
03848
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3]
!ll&&!rl&&r
00851
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3]
!ll&&!rl&&r
00851
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2]
!ll&&!rl&&r
00851
defined $self->[1] and not ref $self->[1] and defined $self->[2]
!ll&&!rl&&r
00851
defined $self->[1] and not ref $self->[1]
!ll&&!rl&&r
00851
MC/DC14%1/7
defined $self->[1] and not ref $self->[1] and defined $self->[2] and not ref $self->[2] and defined $self->[3] and not ref $self->[3] and check_date(@{$self;}[1..3])
defined $self->[1] not ref $self->[1] defined $self->[2] not ref $self->[2] defined $self->[3] not ref $self->[3] check_date(@{$self;}[1..3])
Truth table25%2/8
A and not(B) and C and not(D) and E and not(F) and G
A= defined $self->[1]B= not ref $self->[1]C= defined $self->[2]D= not ref $self->[2]E= defined $self->[3]F= not ref $self->[3]G= check_date(@{$self;}[1..3])
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
491 );
492 848 ▶ if (@{$self} > 4) # is_long
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} > 4) 314 534 848
493 {
494 return 0 unless
495 (
496 defined($self->[4]) and not ref($self->[4]) and
497 defined($self->[5]) and not ref($self->[5]) and
498 defined($self->[6]) and not ref($self->[6]) and
499 314 ▶ check_time(@{$self}[4..6])
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6] and check_time(@{$self;}[4..6]) 0 314 314
Condition33%6/18
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6] and check_time(@{$self;}[4..6])
!ll&&!rl&&r
00314
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6]
!ll&&!rl&&r
00314
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6]
!ll&&!rl&&r
00314
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5]
!ll&&!rl&&r
00314
defined $self->[4] and not ref $self->[4] and defined $self->[5]
!ll&&!rl&&r
00314
defined $self->[4] and not ref $self->[4]
!ll&&!rl&&r
00314
MC/DC0%0/7
defined $self->[4] and not ref $self->[4] and defined $self->[5] and not ref $self->[5] and defined $self->[6] and not ref $self->[6] and check_time(@{$self;}[4..6])
defined $self->[4] not ref $self->[4] defined $self->[5] not ref $self->[5] defined $self->[6] not ref $self->[6] check_time(@{$self;}[4..6])
Truth table12%1/8
A and not(B) and C and not(D) and E and not(F) and G
A= defined $self->[4]B= not ref $self->[4]C= defined $self->[5]D= not ref $self->[5]E= defined $self->[6]F= not ref $self->[6]G= check_time(@{$self;}[4..6])
ABCDEFGresult
0XXXXXX0
10XXXXX0
110XXXX0
1110XXX0
11110XX0
111110X0
11111100
11111111
500 );
501 }
502 848 return 1;
503 }
504 }
505 3 return undef;
506 };
507 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1275 1275
508 1275 return $bool;
509 }
510  
511 sub normalize
512 13 ▶{
Subroutine normalize: called CC=18 SCAR=29.6
Pod undocumented
513 13 my($self) = shift;
514 13 my($quot);
515  
516 13 ▶ if ($self->is_valid())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_valid) 13 0 13
517 {
518 13 ▶ if ($self->is_delta())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_delta) { } 12 1 13
519 {
520 12 ▶ if ($self->is_long())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_long) 12 0 12
521 {
522 12 splice( @{$self}, 3, 4, Normalize_DHMS(@{$self}[3..6]) );
523 }
524 12 ▶ unless ($ACCURATE_MODE) # YMD_MODE or N_YMD_MODE
Branch: 1 branch
BranchTrueFalseTotal
unless ($ACCURATE_MODE) 6 6 12
525 {
526 6 ▶ if ($self->[2] and ($quot = int($self->[2] / 12)))
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[2] and $quot = int $self->[2] / 12) 4 2 6
Condition66%2/3
$self->[2] and $quot = int $self->[2] / 12
!ll&&!rl&&r
024
MC/DC50%1/2
$self->[2] and $quot = int $self->[2] / 12
$self->[2] $quot = int $self->[2] / 12
Truth table66%2/3
A and B
A= $self->[2]B= $quot = int $self->[2] / 12
ABresult
0X0
100
111
527 {
528 4 $self->[1] += $quot;
529 4 $self->[2] -= $quot * 12;
530 }
531 6 ▶ if
Branch: 2 branches
BranchTrueFalseTotal
if ($self->[2] < 0 and $self->[3] > 0 || $self->[4] > 0 || $self->[5] > 0 || $self->[6] > 0) { } 1 5 6
elsif ($self->[2] > 0 and $self->[3] < 0 || $self->[4] < 0 || $self->[5] < 0 || $self->[6] < 0) { } 3 3 6
Condition75%9/12
$self->[2] < 0 and $self->[3] > 0 || $self->[4] > 0 || $self->[5] > 0 || $self->[6] > 0
!ll&&!rl&&r
411
$self->[3] > 0 or $self->[4] > 0 or $self->[5] > 0 or $self->[6] > 0
l!l&&r!l&&!r
101
$self->[3] > 0 or $self->[4] > 0 or $self->[5] > 0
l!l&&r!l&&!r
101
$self->[3] > 0 or $self->[4] > 0
l!l&&r!l&&!r
101
MC/DC40%2/5
$self->[2] < 0 and $self->[3] > 0 || $self->[4] > 0 || $self->[5] > 0 || $self->[6] > 0
$self->[2] < 0 $self->[3] > 0 $self->[4] > 0 $self->[5] > 0 $self->[6] > 0
Truth table50%3/6
A and B or C or D or E
A= $self->[2] < 0B= $self->[3] > 0C= $self->[4] > 0D= $self->[5] > 0E= $self->[6] > 0
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
532 (
533 $self->[2] < 0 and
534 ( $self->[3] > 0 or
535 $self->[4] > 0 or
536 $self->[5] > 0 or
537 $self->[6] > 0 )
538 )
539 {
540 1 $self->[1]--;
541 1 $self->[2] += 12;
542 }
543 ▶ elsif
Condition75%9/12
$self->[2] > 0 and $self->[3] < 0 || $self->[4] < 0 || $self->[5] < 0 || $self->[6] < 0
!ll&&!rl&&r
113
$self->[3] < 0 or $self->[4] < 0 or $self->[5] < 0 or $self->[6] < 0
l!l&&r!l&&!r
301
$self->[3] < 0 or $self->[4] < 0 or $self->[5] < 0
l!l&&r!l&&!r
301
$self->[3] < 0 or $self->[4] < 0
l!l&&r!l&&!r
301
MC/DC40%2/5
$self->[2] > 0 and $self->[3] < 0 || $self->[4] < 0 || $self->[5] < 0 || $self->[6] < 0
$self->[2] > 0 $self->[3] < 0 $self->[4] < 0 $self->[5] < 0 $self->[6] < 0
Truth table50%3/6
A and B or C or D or E
A= $self->[2] > 0B= $self->[3] < 0C= $self->[4] < 0D= $self->[5] < 0E= $self->[6] < 0
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
544 (
545 $self->[2] > 0 and
546 ( $self->[3] < 0 or
547 $self->[4] < 0 or
548 $self->[5] < 0 or
549 $self->[6] < 0 )
550 )
551 {
552 3 $self->[1]++;
553 3 $self->[2] -= 12;
554 }
555 }
556 }
557 else
558 {
559 1 ▶ carp("normalizing a date is a no-op") if ($^W);
Branch: 1 branch
BranchTrueFalseTotal
if $^W 1 0 1
560 }
561 }
562 13 return $self;
563 }
564  
565 sub new
566 538 ▶{
Subroutine new: called CC=19 SCAR=29.5
Pod undocumented
567 538 my($class,$list,$type,$self);
568  
569 538 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 538 0 538
570 {
571 538 $class = shift;
572 538 ▶ if (@_ == 1 and ref($_[0]) eq 'ARRAY') { $list = $_[0]; } else { $list = \@_; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'ARRAY') { } 29 509 538
Condition100%3/3
@_ == 1 and ref $_[0] eq "ARRAY"
!ll&&!rl&&r
507229
MC/DC100%2/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1 ref $_[0] eq "ARRAY"
Truth table100%3/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
ABresult
0X0
100
111
573 }
574 538 ▶ croak("wrong number of arguments")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7 6 532 538
Condition94%17/18
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7
!ll&&!rl&&r
06532
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6 or @$list == 7
l!l&&r!l&&!r
3601726
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6
l!l&&r!l&&!r
3528178
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4
l!l&&r!l&&!r
110242186
@$list == 0 or @$list == 1 or @$list == 3
l!l&&r!l&&!r
4664428
@$list == 0 or @$list == 1
l!l&&r!l&&!r
442492
MC/DC85%6/7
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7
defined $list @$list == 0 @$list == 1 @$list == 3 @$list == 4 @$list == 6 @$list == 7
Truth table87%7/8
A and B or C or D or E or F or G
A= defined $listB= @$list == 0C= @$list == 1D= @$list == 3E= @$list == 4F= @$list == 6G= @$list == 7
ABCDEFGresult
0XXXXXX0
10000000
11XXXXX1
101XXXX1
1001XXX1
10001XX1
100001X1
10000011
575 unless (defined($list) and
576 (@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6 or @$list == 7));
577 532 ▶ if (@$list == 1 or @$list == 4 or @$list == 7)
Branch: 2 branches
BranchTrueFalseTotal
if (@$list == 1 or @$list == 4 or @$list == 7) { } 416 116 532
elsif (@$list == 3 or @$list == 6) { } 72 44 116
Condition100%6/6
@$list == 1 or @$list == 4 or @$list == 7
l!l&&r!l&&!r
244172116
@$list == 1 or @$list == 4
l!l&&r!l&&!r
2242288
MC/DC100%3/3
@$list == 1 or @$list == 4 or @$list == 7
@$list == 1 @$list == 4 @$list == 7
Truth table100%4/4
A or B or C
A= @$list == 1B= @$list == 4C= @$list == 7
ABCresult
1XX1
01X1
0011
0000
578 {
579 416 ▶ $type = (shift(@$list) ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
shift @$list ? : 106 310 416
580 416 $self = [ [$type], @$list ];
581 }
582 ▶ elsif (@$list == 3 or @$list == 6)
Condition100%3/3
@$list == 3 or @$list == 6
l!l&&r!l&&!r
64844
MC/DC100%2/2
@$list == 3 or @$list == 6
@$list == 3 @$list == 6
Truth table100%3/3
A or B
A= @$list == 3B= @$list == 6
ABresult
1X1
011
000
583 {
584 72 $self = [ [0], @$list ];
585 }
586 else
587 {
588 44 $self = [ [] ];
589 }
590 532 ▶ bless($self, ref($class) || $class || 'Date::Calc');
Condition60%3/5
ref $class || $class || 'Date::Calc'
l!l
5320
ref $class or $class
l!l&&r!l&&!r
3122200
MC/DC0%0/2
ref $class || $class || 'Date::Calc'
ref $class $class
Truth table66%2/3
A or B
A= ref $classB= $class
ABresult
1X1
011
000
591 532 return $self;
592 }
593  
594 sub clone
595 18 ▶{
Subroutine clone: called CC=2 SCAR=6.9
Pod undocumented
596 18 my($self) = @_;
597 18 my($this);
598  
599 18 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 18 18
600 18 $this = $self->new();
601 18 @{$this} = @{$self};
602 18 $this->[0] = [];
603 18 @{$this->[0]} = @{$self->[0]};
604 18 return $this;
605 }
606  
607 sub copy
608 2 ▶{
Subroutine copy: called CC=7 SCAR=21.6
Pod undocumented
609 2 my($self) = shift;
610 2 my($this);
611  
612 eval
613 2 {
614 0 ▶ if (@_ == 1 and ref($_[0])) { $this = $_[0]; } else { $this = \@_; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0]) { } 2 0 2
Condition33%1/3
@_ == 1 and ref $_[0]
!ll&&!rl&&r
002
MC/DC0%0/2
@_ == 1 and ref $_[0]
@_ == 1 ref $_[0]
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0]
ABresult
0X0
100
111
615 2 @{$self} = @{$this};
616 2 $self->[0] = [];
617 2 ▶ if (defined $this->[0])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $this->[0]) 2 0 2
618 {
619 2 ▶ if (ref($this->[0]) eq 'ARRAY') { @{$self->[0]} = @{$this->[0]}; }
Branch: 1 branch
BranchTrueFalseTotal
if (ref $this->[0] eq 'ARRAY') { } 2 0 2
620 0 else { $self->[0][0] = $this->[0]; }
621 }
622 };
623 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 2 2
624 2 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 2 2
625 2 return $self;
626 }
627  
628 sub date
629 42 ▶{
Subroutine date: called CC=19 SCAR=35.0
Pod undocumented
630 42 my($self,$list);
631  
632 42 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 42 0 42
633 {
634 42 $self = shift;
635 0 ▶ if (@_ == 1 and ref($_[0]) eq 'ARRAY') { $list = $_[0]; } else { $list = \@_; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'ARRAY') { } 0 42 42
Condition33%1/3
@_ == 1 and ref $_[0] eq "ARRAY"
!ll&&!rl&&r
4200
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1 ref $_[0] eq "ARRAY"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
ABresult
0X0
100
111
636 }
637 42 ▶ croak("wrong number of arguments")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7 0 42 42
Condition61%11/18
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7
!ll&&!rl&&r
0042
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6 or @$list == 7
l!l&&r!l&&!r
3750
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6
l!l&&r!l&&!r
3705
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4
l!l&&r!l&&!r
3705
@$list == 0 or @$list == 1 or @$list == 3
l!l&&r!l&&!r
3705
@$list == 0 or @$list == 1
l!l&&r!l&&!r
3705
MC/DC0%0/7
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7
defined $list @$list == 0 @$list == 1 @$list == 3 @$list == 4 @$list == 6 @$list == 7
Truth table25%2/8
A and B or C or D or E or F or G
A= defined $listB= @$list == 0C= @$list == 1D= @$list == 3E= @$list == 4F= @$list == 6G= @$list == 7
ABCDEFGresult
0XXXXXX0
10000000
11XXXXX1
101XXXX1
1001XXX1
10001XX1
100001X1
10000011
638 unless (defined($list) and
639 (@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6 or @$list == 7));
640 eval
641 42 {
642 42 ▶ if (@$list == 1 or @$list == 4 or @$list == 7)
Branch: 1 branch
BranchTrueFalseTotal
if (@$list == 1 or @$list == 4 or @$list == 7) 5 37 42
Condition50%3/6
@$list == 1 or @$list == 4 or @$list == 7
l!l&&r!l&&!r
0537
@$list == 1 or @$list == 4
l!l&&r!l&&!r
0042
MC/DC33%1/3
@$list == 1 or @$list == 4 or @$list == 7
@$list == 1 @$list == 4 @$list == 7
Truth table50%2/4
A or B or C
A= @$list == 1B= @$list == 4C= @$list == 7
ABCresult
1XX1
01X1
0011
0000
643 {
644 5 ▶ $self->[0][0] = (shift(@$list) ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
shift @$list ? : 0 5 5
645 }
646 42 ▶ if (@$list == 3 or @$list == 6)
Branch: 1 branch
BranchTrueFalseTotal
if (@$list == 3 or @$list == 6) 5 37 42
Condition66%2/3
@$list == 3 or @$list == 6
l!l&&r!l&&!r
0537
MC/DC50%1/2
@$list == 3 or @$list == 6
@$list == 3 @$list == 6
Truth table66%2/3
A or B
A= @$list == 3B= @$list == 6
ABresult
1X1
011
000
647 {
648 5 splice( @{$self}, 1, scalar(@$list), @$list );
649 }
650 };
651 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 42 42
652 42 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 42 42
653 42 return (@{$self}[1..3]);
654 }
655  
656 sub time
657 15 ▶{
Subroutine time: called CC=16 SCAR=34.0
Pod undocumented
658 15 my($self,$list);
659  
660 15 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 15 0 15
661 {
662 15 $self = shift;
663 0 ▶ if (@_ == 1 and ref($_[0]) eq 'ARRAY') { $list = $_[0]; } else { $list = \@_; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'ARRAY') { } 0 15 15
Condition33%1/3
@_ == 1 and ref $_[0] eq "ARRAY"
!ll&&!rl&&r
1500
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1 ref $_[0] eq "ARRAY"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
ABresult
0X0
100
111
664 }
665 15 ▶ croak("wrong number of arguments")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 0 15 15
Condition50%6/12
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4
!ll&&!rl&&r
0015
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4
l!l&&r!l&&!r
1500
@$list == 0 or @$list == 1 or @$list == 3
l!l&&r!l&&!r
1410
@$list == 0 or @$list == 1
l!l&&r!l&&!r
1401
MC/DC0%0/5
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4
defined $list @$list == 0 @$list == 1 @$list == 3 @$list == 4
Truth table33%2/6
A and B or C or D or E
A= defined $listB= @$list == 0C= @$list == 1D= @$list == 3E= @$list == 4
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
666 unless (defined($list) and
667 (@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4));
668 eval
669 15 {
670 15 ▶ if (@$list == 1 or @$list == 4)
Branch: 1 branch
BranchTrueFalseTotal
if (@$list == 1 or @$list == 4) 0 15 15
Condition33%1/3
@$list == 1 or @$list == 4
l!l&&r!l&&!r
0015
MC/DC0%0/2
@$list == 1 or @$list == 4
@$list == 1 @$list == 4
Truth table33%1/3
A or B
A= @$list == 1B= @$list == 4
ABresult
1X1
011
000
671 {
672 0 ▶ $self->[0][0] = (shift(@$list) ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
shift @$list ? : 0 0 0
673 }
674 15 ▶ if (@$list == 3)
Branch: 1 branch
BranchTrueFalseTotal
if (@$list == 3) 1 14 15
675 {
676 1 splice( @{$self}, 4, 3, @$list );
677 }
678 };
679 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 15 15
680 15 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 15 15
681 15 ▶ if (@{$self} == 7) { return (@{$self}[4..6]); }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) { } 14 1 15
682 1 else { return (); }
683 }
684  
685 sub datetime
686 13 ▶{
Subroutine datetime: called CC=20 SCAR=42.5
Pod undocumented
687 13 my($self,$list);
688  
689 13 ▶ if (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 13 0 13
690 {
691 13 $self = shift;
692 0 ▶ if (@_ == 1 and ref($_[0]) eq 'ARRAY') { $list = $_[0]; } else { $list = \@_; }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'ARRAY') { } 0 13 13
Condition33%1/3
@_ == 1 and ref $_[0] eq "ARRAY"
!ll&&!rl&&r
1300
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1 ref $_[0] eq "ARRAY"
Truth table33%1/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
ABresult
0X0
100
111
693 }
694 13 ▶ croak("wrong number of arguments")
Branch: 1 branch
BranchTrueFalseTotal
unless defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7 0 13 13
Condition33%6/18
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7
!ll&&!rl&&r
0013
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6 or @$list == 7
l!l&&r!l&&!r
1300
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6
l!l&&r!l&&!r
1300
@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4
l!l&&r!l&&!r
1300
@$list == 0 or @$list == 1 or @$list == 3
l!l&&r!l&&!r
1300
@$list == 0 or @$list == 1
l!l&&r!l&&!r
1300
MC/DC0%0/7
defined $list and @$list == 0 || @$list == 1 || @$list == 3 || @$list == 4 || @$list == 6 || @$list == 7
defined $list @$list == 0 @$list == 1 @$list == 3 @$list == 4 @$list == 6 @$list == 7
Truth table12%1/8
A and B or C or D or E or F or G
A= defined $listB= @$list == 0C= @$list == 1D= @$list == 3E= @$list == 4F= @$list == 6G= @$list == 7
ABCDEFGresult
0XXXXXX0
10000000
11XXXXX1
101XXXX1
1001XXX1
10001XX1
100001X1
10000011
695 unless (defined($list) and
696 (@$list == 0 or @$list == 1 or @$list == 3 or @$list == 4 or @$list == 6 or @$list == 7));
697 eval
698 13 {
699 13 ▶ if (@$list == 1 or @$list == 4 or @$list == 7)
Branch: 1 branch
BranchTrueFalseTotal
if (@$list == 1 or @$list == 4 or @$list == 7) 0 13 13
Condition33%2/6
@$list == 1 or @$list == 4 or @$list == 7
l!l&&r!l&&!r
0013
@$list == 1 or @$list == 4
l!l&&r!l&&!r
0013
MC/DC0%0/3
@$list == 1 or @$list == 4 or @$list == 7
@$list == 1 @$list == 4 @$list == 7
Truth table25%1/4
A or B or C
A= @$list == 1B= @$list == 4C= @$list == 7
ABCresult
1XX1
01X1
0011
0000
700 {
701 0 ▶ $self->[0][0] = (shift(@$list) ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
shift @$list ? : 0 0 0
702 }
703 13 ▶ if (@$list == 3)
Branch: 2 branches
BranchTrueFalseTotal
if (@$list == 3) { } 0 13 13
elsif (@$list == 6) { } 0 13 13
704 {
705 0 splice( @{$self}, 1, 6, @$list, 0,0,0 );
706 }
707 elsif (@$list == 6)
708 {
709 0 splice( @{$self}, 1, 6, @$list );
710 }
711 };
712 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 13 13
713 13 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 13 13
714 13 ▶ if (@{$self} == 7) { return (@{$self}[1..6]); }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) { } 8 5 13
715 5 else { return (@{$self}[1..3],0,0,0); }
716 }
717  
718 sub today
719 0 ▶{
Subroutine today: not called CC=4 SCAR=30.0
Pod undocumented
720 0 my($self) = shift;
721 0 ▶ my($gmt) = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
722  
723 0 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 0 0 0
724 {
725 0 $self->date( 0, Today($gmt) );
726 0 return $self;
727 }
728 else # class method
729 {
730 0 ▶ $self ||= 'Date::Calc';
Condition0%0/2
$self ||= "Date::Calc"
l!l
00
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table0%0/2
A
A= $self
Aresult
11
00
731 0 return $self->new( 0, Today($gmt) );
732 }
733 }
734  
735 sub now
736 0 ▶{
Subroutine now: not called CC=4 SCAR=30.0
Pod undocumented
737 0 my($self) = shift;
738 0 ▶ my($gmt) = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
739  
740 0 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 0 0 0
741 {
742 0 $self->time( 0, Now($gmt) );
743 0 return $self;
744 }
745 else # class method
746 {
747 0 ▶ $self ||= 'Date::Calc';
Condition0%0/2
$self ||= "Date::Calc"
l!l
00
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table0%0/2
A
A= $self
Aresult
11
00
748 0 return $self->new( 0, Today_and_Now($gmt) );
749 }
750 }
751  
752 sub today_and_now
753 0 ▶{
Subroutine today_and_now: not called CC=4 SCAR=30.0
Pod undocumented
754 0 my($self) = shift;
755 0 ▶ my($gmt) = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
756  
757 0 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 0 0 0
758 {
759 0 $self->date( 0, Today_and_Now($gmt) );
760 0 return $self;
761 }
762 else # class method
763 {
764 0 ▶ $self ||= 'Date::Calc';
Condition0%0/2
$self ||= "Date::Calc"
l!l
00
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table0%0/2
A
A= $self
Aresult
11
00
765 0 return $self->new( 0, Today_and_Now($gmt) );
766 }
767 }
768  
769 sub gmtime
770 1 ▶{
Subroutine gmtime: called CC=4 SCAR=17.4
Pod undocumented
771 1 my($self) = shift;
772 1 my(@date);
773  
774 eval
775 1 {
776 1 @date = (Gmtime(@_))[0..5];
777 };
778 1 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
779 {
780 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
781 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
782 0 croak($@);
783 }
784 1 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 1 0 1
785 {
786 1 $self->date( 0, @date );
787 1 return $self;
788 }
789 else # class method
790 {
791 0 ▶ $self ||= 'Date::Calc';
Condition0%0/2
$self ||= "Date::Calc"
l!l
00
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table0%0/2
A
A= $self
Aresult
11
00
792 0 return $self->new( 0, @date );
793 }
794 }
795  
796 sub localtime
797 1 ▶{
Subroutine localtime: called CC=4 SCAR=17.4
Pod undocumented
798 1 my($self) = shift;
799 1 my(@date);
800  
801 eval
802 1 {
803 1 @date = (Localtime(@_))[0..5];
804 };
805 1 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
806 {
807 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
808 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
809 0 croak($@);
810 }
811 1 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 1 0 1
812 {
813 1 $self->date( 0, @date );
814 1 return $self;
815 }
816 else # class method
817 {
818 0 ▶ $self ||= 'Date::Calc';
Condition0%0/2
$self ||= "Date::Calc"
l!l
00
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table0%0/2
A
A= $self
Aresult
11
00
819 0 return $self->new( 0, @date );
820 }
821 }
822  
823 sub mktime
824 1 ▶{
Subroutine mktime: called CC=5 SCAR=18.5
Pod undocumented
825 1 my($self) = @_;
826 1 my($time);
827  
828 1 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 1 0 1
829 {
830 1 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 1 1
831 1 ▶ croak("can't mktime from a delta vector") if ($self->is_delta()); # add [1970,1,1,0,0,0] first!
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_delta 0 1 1
832 eval
833 1 {
834 1 $time = Mktime( $self->datetime() );
835 };
836 1 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
837 {
838 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
839 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
840 0 croak($@);
841 }
842 1 return $time;
843 }
844 else # class method
845 {
846 0 return CORE::time();
847 }
848 }
849  
850 sub tzoffset
851 0 ▶{
Subroutine tzoffset: not called CC=4 SCAR=30.0
Pod undocumented
852 0 my($self) = shift;
853 0 my(@diff);
854  
855 eval
856 0 {
857 0 @diff = (Timezone(@_))[0..5];
858 };
859 0 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
860 {
861 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
862 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
863 0 croak($@);
864 }
865 0 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 0 0 0
866 {
867 0 $self->date( 1, @diff );
868 0 return $self;
869 }
870 else # class method
871 {
872 0 ▶ $self ||= 'Date::Calc';
Condition0%0/2
$self ||= "Date::Calc"
l!l
00
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table0%0/2
A
A= $self
Aresult
11
00
873 0 return $self->new( 1, @diff );
874 }
875 }
876  
877 sub date2time
878 3 ▶{
Subroutine date2time: called CC=5 SCAR=18.5
Pod undocumented
879 3 my($self) = @_;
880 3 my($time);
881  
882 3 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 3 0 3
883 {
884 3 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 3 3
885 3 ▶ croak("can't make time from a delta vector") if ($self->is_delta()); # add [1970,1,1,0,0,0] first!
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_delta 0 3 3
886 eval
887 3 {
888 3 $time = Date_to_Time( $self->datetime() );
889 };
890 3 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 3 3
891 {
892 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
893 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
894 0 croak($@);
895 }
896 3 return $time;
897 }
898 else # class method
899 {
900 0 return CORE::time();
901 }
902 }
903  
904 sub time2date
905 4 ▶{
Subroutine time2date: called CC=4 SCAR=14.6
Pod undocumented
906 4 my($self) = shift;
907 4 my(@date);
908  
909 eval
910 4 {
911 4 @date = Time_to_Date(@_);
912 };
913 4 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 4 4
914 {
915 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
916 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
917 0 croak($@);
918 }
919 4 ▶ if (ref $self) # object method
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self) { } 3 1 4
920 {
921 3 $self->date( 0, @date );
922 3 return $self;
923 }
924 else # class method
925 {
926 1 ▶ $self ||= 'Date::Calc';
Condition50%1/2
$self ||= "Date::Calc"
l!l
10
MC/DC0%0/1
$self ||= "Date::Calc"
$self
Truth table50%1/2
A
A= $self
Aresult
11
00
927 1 return $self->new( 0, @date );
928 }
929 }
930  
931 sub year
932 24 ▶{
Subroutine year: called CC=5 SCAR=24.7
Pod undocumented
933 24 my($self) = shift;
934  
935 24 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 0 24 24
936 {
937 0 ▶ eval { $self->[1] = $_[0] || 0; };
Condition0%0/2
$_[0] || 0
l!l
00
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
938 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
939 }
940 24 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 24 24
941 24 return $self->[1];
942 }
943  
944 sub month
945 9 ▶{
Subroutine month: called CC=5 SCAR=24.7
Pod undocumented
946 9 my($self) = shift;
947  
948 9 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 0 9 9
949 {
950 0 ▶ eval { $self->[2] = $_[0] || 0; };
Condition0%0/2
$_[0] || 0
l!l
00
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
951 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
952 }
953 9 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 9 9
954 9 return $self->[2];
955 }
956  
957 sub day
958 10 ▶{
Subroutine day: called CC=5 SCAR=17.3
Pod undocumented
959 10 my($self) = shift;
960  
961 10 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 1 9 10
962 {
963 1 ▶ eval { $self->[3] = $_[0] || 0; };
Condition50%1/2
$_[0] || 0
l!l
10
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table50%1/2
A
A= $_[0]
Aresult
11
00
964 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
965 }
966 10 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 10 10
967 10 return $self->[3];
968 }
969  
970 sub hours
971 9 ▶{
Subroutine hours: called CC=8 SCAR=32.9
Pod undocumented
972 9 my($self) = shift;
973  
974 9 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 0 9 9
975 {
976 eval
977 0 {
978 0 ▶ if (@{$self} == 4)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) 0 0 0
979 {
980 0 $self->[4] = 0;
981 0 $self->[5] = 0;
982 0 $self->[6] = 0;
983 }
984 0 ▶ if (@{$self} == 7)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) 0 0 0
985 {
986 0 ▶ $self->[4] = $_[0] || 0;
Condition0%0/2
$_[0] || 0
l!l
00
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
987 }
988 };
989 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
990 }
991 9 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 9 9
992 9 ▶ if (@{$self} == 7) { return $self->[4]; }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) { } 4 5 9
993 5 else { return undef; }
994 }
995  
996 sub minutes
997 9 ▶{
Subroutine minutes: called CC=8 SCAR=32.9
Pod undocumented
998 9 my($self) = shift;
999  
1000 9 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 0 9 9
1001 {
1002 eval
1003 0 {
1004 0 ▶ if (@{$self} == 4)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) 0 0 0
1005 {
1006 0 $self->[4] = 0;
1007 0 $self->[5] = 0;
1008 0 $self->[6] = 0;
1009 }
1010 0 ▶ if (@{$self} == 7)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) 0 0 0
1011 {
1012 0 ▶ $self->[5] = $_[0] || 0;
Condition0%0/2
$_[0] || 0
l!l
00
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
1013 }
1014 };
1015 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1016 }
1017 9 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 9 9
1018 9 ▶ if (@{$self} == 7) { return $self->[5]; }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) { } 4 5 9
1019 5 else { return undef; }
1020 }
1021  
1022 sub seconds
1023 9 ▶{
Subroutine seconds: called CC=8 SCAR=32.9
Pod undocumented
1024 9 my($self) = shift;
1025  
1026 9 ▶ if (@_ > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (@_ > 0) 0 9 9
1027 {
1028 eval
1029 0 {
1030 0 ▶ if (@{$self} == 4)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) 0 0 0
1031 {
1032 0 $self->[4] = 0;
1033 0 $self->[5] = 0;
1034 0 $self->[6] = 0;
1035 }
1036 0 ▶ if (@{$self} == 7)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) 0 0 0
1037 {
1038 0 ▶ $self->[6] = $_[0] || 0;
Condition0%0/2
$_[0] || 0
l!l
00
MC/DC0%0/1
$_[0] || 0
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
1039 }
1040 };
1041 0 ▶ if ($@) { $@ =~ s!\s+at\s+\S.*\s*$!!; croak($@); }
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1042 }
1043 9 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 9 9
1044 9 ▶ if (@{$self} == 7) { return $self->[6]; }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) { } 4 5 9
1045 5 else { return undef; }
1046 }
1047  
1048 ###############################
1049 ## ##
1050 ## Selector constants ##
1051 ## for formatting ##
1052 ## callback functions: ##
1053 ## ##
1054 ###############################
1055 ## ##
1056 ## IS_SHORT = 0x00; ##
1057 ## IS_LONG = 0x01; ##
1058 ## IS_DATE = 0x00; ##
1059 ## IS_DELTA = 0x02; ##
1060 ## TO_NUMBER = 0x00; ##
1061 ## TO_STRING = 0x04; ##
1062 ## ##
1063 ###############################
1064  
1065 sub number
1066 40 ▶{
Subroutine number: called CC=18 SCAR=36.0
Pod undocumented
1067 40 my($self,$format) = @_;
1068 40 my($number,$sign,@temp);
1069  
1070 40 ▶ if ($self->is_valid())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_valid) 40 0 40
1071 {
1072 eval
1073 40 {
1074 40 ▶ $format = $NUMBER_FORMAT unless (defined $format); # because of overloading!
Branch: 1 branch
BranchTrueFalseTotal
unless defined $format 32 8 40
1075 40 ▶ if ($self->[0][0]) # is_delta
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0][0]) { } 26 14 40
1076 {
1077 # carp("returning a fictitious number of days for delta vector")
1078 # if ((($self->[1] != 0) or ($self->[2] != 0)) and $^W);
1079 26 ▶ if (@{$self} == 4) # is_short
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) { } 24 2 26
1080 {
1081 24 ▶ if (ref($format) eq 'CODE')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 0 24 24
1082 {
1083 0 $number = &{$format}( $self, 0x02 ); # = TO_NUMBER | IS_DELTA | IS_SHORT
1084 }
1085 else
1086 {
1087 24 $number = ($self->[1]*12+$self->[2])*31+$self->[3];
1088 }
1089 }
1090 else # is_long
1091 {
1092 2 ▶ if (ref($format) eq 'CODE')
Branch: 2 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 0 2 2
elsif ($format == 2) { } 0 2 2
1093 {
1094 0 $number = &{$format}( $self, 0x03 ); # = TO_NUMBER | IS_DELTA | IS_LONG
1095 }
1096 elsif ($format == 2)
1097 {
1098 0 $number = ($self->[1]*12+$self->[2])*31+$self->[3] +
1099 ((($self->[4]*60+$self->[5])*60+$self->[6])/86400);
1100 }
1101 else
1102 {
1103 2 local($_);
1104 2 $sign = 0;
1105 2 @temp = @{$self}[3..6];
1106 2 $temp[0] += ($self->[1] * 12 + $self->[2]) * 31;
1107 2 ▶ @temp = map( $_ < 0 ? $sign = -$_ : $_, Normalize_DHMS(@temp) );
Branch: 1 branch
BranchTrueFalseTotal
$_ < 0 ? : 4 4 8
1108 2 ▶ $number = sprintf( "%s%d.%02d%02d%02d", $sign ? '-' : '', @temp );
Branch: 1 branch
BranchTrueFalseTotal
$sign ? : 1 1 2
1109 }
1110 }
1111 }
1112 else # is_date
1113 {
1114 14 ▶ if (@{$self} == 4) # is_short
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) { } 8 6 14
1115 {
1116 8 ▶ if (ref($format) eq 'CODE')
Branch: 2 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 0 8 8
elsif ($format == 2 or $format == 1) { } 0 8 8
1117 {
1118 0 $number = &{$format}( $self, 0x00 ); # = TO_NUMBER | IS_DATE | IS_SHORT
1119 }
1120 ▶ elsif ($format == 2 or $format == 1)
Condition33%1/3
$format == 2 or $format == 1
l!l&&r!l&&!r
008
MC/DC0%0/2
$format == 2 or $format == 1
$format == 2 $format == 1
Truth table33%1/3
A or B
A= $format == 2B= $format == 1
ABresult
1X1
011
000
1121 {
1122 0 $number = Date_to_Days( @{$self}[1..3] );
1123 }
1124 else
1125 {
1126 $number = sprintf( "%04d%02d%02d",
1127 8 @{$self}[1..3] );
1128 }
1129 }
1130 else # is_long
1131 {
1132 6 ▶ if (ref($format) eq 'CODE')
Branch: 3 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 0 6 6
elsif ($format == 2) { } 0 6 6
elsif ($format == 1) { } 0 6 6
1133 {
1134 0 $number = &{$format}( $self, 0x01 ); # = TO_NUMBER | IS_DATE | IS_LONG
1135 }
1136 elsif ($format == 2)
1137 {
1138 0 $number = Date_to_Days( @{$self}[1..3] ) +
1139 ((($self->[4]*60+$self->[5])*60+$self->[6])/86400);
1140 }
1141 elsif ($format == 1)
1142 {
1143 0 $number = Date_to_Days( @{$self}[1..3] ) .
1144 0 sprintf( ".%02d%02d%02d", @{$self}[4..6] );
1145 }
1146 else
1147 {
1148 $number = sprintf( "%04d%02d%02d.%02d%02d%02d",
1149 6 @{$self}[1..6] );
1150 }
1151 }
1152 }
1153 };
1154 40 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 40 40
1155 {
1156 0 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
1157 0 $@ =~ s!\s+at\s+\S.*\s*$!!;
1158 0 croak($@);
1159 }
1160 40 return $number;
1161 }
1162 0 return undef;
1163 }
1164  
1165 sub string
1166 142 ▶{
Subroutine string: called CC=36 SCAR=43.2
Pod undocumented
1167 142 my($self,$format,$lang) = @_;
1168 142 my($restore,$string);
1169  
1170 142 ▶ if ($self->is_valid())
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_valid) 142 0 142
1171 {
1172 142 ▶ if (defined($lang) and $lang ne '') # because of overloading!
Branch: 1 branch
BranchTrueFalseTotal
if (defined $lang and $lang ne '') { } 4 138 142
Condition66%2/3
defined $lang and $lang ne ""
!ll&&!rl&&r
01384
MC/DC50%1/2
defined $lang and $lang ne ""
defined $lang $lang ne ""
Truth table66%2/3
A and B
A= defined $langB= $lang ne ""
ABresult
0X0
100
111
1173 {
1174 4 ▶ $lang = Decode_Language($lang) unless ($lang =~ /^\d+$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $lang =~ /^\d+$/ 0 4 4
1175 }
1176 else
1177 {
1178 138 ▶ if (defined $self->[0][3]) { $lang = $self->[0][3]; }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[0][3]) { } 10 128 138
1179 128 else { $lang = Language(); }
1180 }
1181 142 ▶ croak "no such language '$lang'" unless ($lang >= 1 and $lang <= Languages());
Branch: 1 branch
BranchTrueFalseTotal
unless $lang >= 1 and $lang <= Languages() 1 141 142
Condition66%2/3
$lang >= 1 and $lang <= Languages()
!ll&&!rl&&r
10141
MC/DC50%1/2
$lang >= 1 and $lang <= Languages()
$lang >= 1 $lang <= Languages()
Truth table66%2/3
A and B
A= $lang >= 1B= $lang <= Languages()
ABresult
0X0
100
111
1182 eval
1183 141 {
1184 141 ▶ if ($self->[0][0]) # is_delta
Branch: 1 branch
BranchTrueFalseTotal
if ($self->[0][0]) { } 40 101 141
1185 {
1186 40 ▶ $format = defined($self->[0][1]) ? $self->[0][1] : $DELTA_FORMAT
Branch: 2 branches
BranchTrueFalseTotal
unless defined $format 40 0 40
defined $self->[0][1] ? : 3 37 40
1187 unless (defined $format); # because of overloading!
1188 40 ▶ if (@{$self} == 4) # is_short
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) { } 20 20 40
1189 {
1190 20 ▶ if (ref($format) eq 'CODE')
Branch: 5 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 0 20 20
elsif ($format == 4) { } 0 20 20
elsif ($format == 3) { } 0 20 20
elsif ($format == 2) { } 0 20 20
elsif ($format == 1) { } 20 0 20
1191 {
1192 0 $string = &{$format}( $self, 0x06, $lang ); # = TO_STRING | IS_DELTA | IS_SHORT
1193 }
1194 elsif ($format == 4)
1195 {
1196 0 $string = '(' . join(',', @{$self}[1..3]) . ')';
1197 }
1198 elsif ($format == 3)
1199 {
1200 $string = sprintf( "%+d Y %+d M %+d D",
1201 0 @{$self}[1..3] );
1202 }
1203 elsif ($format == 2)
1204 {
1205 $string = sprintf( "%+dY %+dM %+dD",
1206 0 @{$self}[1..3] );
1207 }
1208 elsif ($format == 1)
1209 {
1210 $string = sprintf( "%+d %+d %+d",
1211 20 @{$self}[1..3] );
1212 }
1213 else
1214 {
1215 $string = sprintf( "%+d%+d%+d",
1216 0 @{$self}[1..3] );
1217 }
1218 }
1219 else # is_long
1220 {
1221 20 ▶ if (ref($format) eq 'CODE')
Branch: 5 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 3 17 20
elsif ($format == 4) { } 0 17 17
elsif ($format == 3) { } 0 17 17
elsif ($format == 2) { } 0 17 17
elsif ($format == 1) { } 16 1 17
1222 {
1223 3 $string = &{$format}( $self, 0x07, $lang ); # = TO_STRING | IS_DELTA | IS_LONG
1224 }
1225 elsif ($format == 4)
1226 {
1227 0 $string = '(' . join(',', @{$self}[1..6]) . ')';
1228 }
1229 elsif ($format == 3)
1230 {
1231 $string = sprintf( "%+d Y %+d M %+d D %+d h %+d m %+d s",
1232 0 @{$self}[1..6] );
1233 }
1234 elsif ($format == 2)
1235 {
1236 $string = sprintf( "%+dY %+dM %+dD %+dh %+dm %+ds",
1237 0 @{$self}[1..6] );
1238 }
1239 elsif ($format == 1)
1240 {
1241 $string = sprintf( "%+d %+d %+d %+d %+d %+d",
1242 16 @{$self}[1..6] );
1243 }
1244 else
1245 {
1246 $string = sprintf( "%+d%+d%+d%+d%+d%+d",
1247 1 @{$self}[1..6] );
1248 }
1249 }
1250 }
1251 else # is_date
1252 {
1253 101 ▶ $format = defined($self->[0][2]) ? $self->[0][2] : $DATE_FORMAT
Branch: 2 branches
BranchTrueFalseTotal
unless defined $format 97 4 101
defined $self->[0][2] ? : 15 82 97
1254 unless (defined $format); # because of overloading!
1255 101 ▶ if (@{$self} == 4) # is_short
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 4) { } 88 13 101
1256 {
1257 88 ▶ if (ref($format) eq 'CODE')
Branch: 5 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 5 83 88
elsif ($format == 4) { } 0 83 83
elsif ($format == 3) { } 15 68 83
elsif ($format == 2) { } 1 67 68
elsif ($format == 1) { } 67 0 67
1258 {
1259 5 $string = &{$format}( $self, 0x04, $lang ); # = TO_STRING | IS_DATE | IS_SHORT
1260 }
1261 elsif ($format == 4)
1262 {
1263 0 $string = '[' . join(',', @{$self}[1..3]) . ']';
1264 }
1265 elsif ($format == 3)
1266 {
1267 15 $string = Date_to_Text_Long( @{$self}[1..3], $lang );
1268 }
1269 elsif ($format == 2)
1270 {
1271 1 $string = Date_to_Text( @{$self}[1..3], $lang );
1272 }
1273 elsif ($format == 1)
1274 {
1275 67 $string = sprintf( "%02d-%.3s-%04d",
1276 $self->[3],
1277 Month_to_Text($self->[2],$lang),
1278 $self->[1] );
1279 }
1280 else
1281 {
1282 $string = sprintf( "%04d%02d%02d",
1283 0 @{$self}[1..3] );
1284 }
1285 }
1286 else # is_long
1287 {
1288 13 ▶ if (ref($format) eq 'CODE')
Branch: 5 branches
BranchTrueFalseTotal
if (ref $format eq 'CODE') { } 6 7 13
elsif ($format == 4) { } 0 7 7
elsif ($format == 3) { } 3 4 7
elsif ($format == 2) { } 0 4 4
elsif ($format == 1) { } 4 0 4
1289 {
1290 6 $string = &{$format}( $self, 0x05, $lang ); # = TO_STRING | IS_DATE | IS_LONG
1291 }
1292 elsif ($format == 4)
1293 {
1294 0 $string = '[' . join(',', @{$self}[1..6]) . ']';
1295 }
1296 elsif ($format == 3)
1297 {
1298 3 $string = Date_to_Text_Long( @{$self}[1..3], $lang ) .
1299 3 sprintf( " %02d:%02d:%02d", @{$self}[4..6] );
1300 }
1301 elsif ($format == 2)
1302 {
1303 0 $string = Date_to_Text( @{$self}[1..3], $lang ) .
1304 0 sprintf( " %02d:%02d:%02d", @{$self}[4..6] );
1305 }
1306 elsif ($format == 1)
1307 {
1308 $string = sprintf( "%02d-%.3s-%04d %02d:%02d:%02d",
1309 $self->[3],
1310 Month_to_Text($self->[2],$lang),
1311 $self->[1],
1312 4 @{$self}[4..6] );
1313 }
1314 else
1315 {
1316 $string = sprintf( "%04d%02d%02d%02d%02d%02d",
1317 0 @{$self}[1..6] );
1318 }
1319 }
1320 }
1321 };
1322 141 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 140 141
1323 {
1324 1 $@ =~ s!^.*[A-Za-z0-9_]+(?:::[A-Za-z0-9_]+)*\(\):\s*!!;
1325 1 $@ =~ s!\s+at\s+\S.*\s*$!!;
1326 1 croak($@);
1327 }
1328 140 return $string;
1329 }
1330 0 return undef;
1331 }
1332  
1333 sub _process_
1334 451 ▶{
Subroutine _process_: called CC=56 SCAR=47.3
1335 451 my($self,$this,$flag,$code) = @_;
1336 451 my($result,$val1,$val2,$len1,$len2,$last,$item);
1337  
1338 451 ▶ croak("invalid date/time") unless ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_valid 0 451 451
1339 451 ▶ if ($code == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($code == 0) 0 451 451
1340 {
1341 0 ▶ croak("can't apply unary minus to a date")
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_delta 0 0 0
1342 unless ($self->is_delta());
1343 0 $result = $self->new();
1344 0 $result->[0][0] = $self->[0][0];
1345 0 ▶ for ( $item = 1; $item < @{$self}; $item++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($item < @{$self;}) 0 0 0
1346 {
1347 0 $result->[$item] = -$self->[$item];
1348 }
1349 0 return $result;
1350 }
1351 451 ▶ if (defined $this and ref($this) =~ /[^:]::[^:]/)
Branch: 3 branches
BranchTrueFalseTotal
if (defined $this and ref($this) =~ /[^:]::[^:]/) { } 368 83 451
elsif (defined $this and ref $this eq 'ARRAY') { } 55 28 83
elsif (defined $this and not ref $this) { } 28 0 28
Condition66%2/3
defined $this and ref($this) =~ /[^:]::[^:]/
!ll&&!rl&&r
083368
MC/DC50%1/2
defined $this and ref($this) =~ /[^:]::[^:]/
defined $this ref($this) =~ /[^:]::[^:]/
Truth table66%2/3
A and B
A= defined $thisB= ref($this) =~ /[^:]::[^:]/
ABresult
0X0
100
111
1352 {
1353 368 ▶ croak("invalid date/time") unless ($this->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $this->is_valid 0 368 368
1354 }
1355 ▶ elsif (defined $this and ref($this) eq 'ARRAY')
Condition66%2/3
defined $this and ref $this eq "ARRAY"
!ll&&!rl&&r
02855
MC/DC50%1/2
defined $this and ref $this eq "ARRAY"
defined $this ref $this eq "ARRAY"
Truth table66%2/3
A and B
A= defined $thisB= ref $this eq "ARRAY"
ABresult
0X0
100
111
1356 {
1357 55 ▶ if (@{$this} == 3 or @{$this} == 6)
Branch: 1 branch
BranchTrueFalseTotal
if (@{$this;} == 3 or @{$this;} == 6) { } 49 6 55
Condition100%3/3
@{$this;} == 3 or @{$this;} == 6
l!l&&r!l&&!r
4366
MC/DC100%2/2
@{$this;} == 3 or @{$this;} == 6
@{$this;} == 3 @{$this;} == 6
Truth table100%3/3
A or B
A= @{$this;} == 3B= @{$this;} == 6
ABresult
1X1
011
000
1358 {
1359 49 ▶ if ($code == 6)
Branch: 2 branches
BranchTrueFalseTotal
if ($code == 6) { } 2 47 49
elsif ($code == 5) { } 16 31 47
1360 {
1361 2 $this = $self->new(0,@{$this});
1362 }
1363 elsif ($code == 5)
1364 {
1365 16 $this = $self->new($self->is_date(),@{$this});
1366 }
1367 else
1368 {
1369 31 $this = $self->new($self->is_delta(),@{$this});
1370 }
1371 }
1372 else
1373 {
1374 6 $this = $self->new(@{$this});
1375 }
1376 55 ▶ croak("invalid date/time") unless ($this->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $this->is_valid 2 53 55
1377 }
1378 ▶ elsif (defined $this and not ref($this))
Condition33%1/3
defined $this and not ref $this
!ll&&!rl&&r
0028
MC/DC0%0/2
defined $this and not ref $this
defined $this not ref $this
Truth table33%1/3
A and not(B)
A= defined $thisB= not ref $this
ABresult
0X0
100
111
1379 {
1380 28 ▶ $this = $self->new(1,0,0,$this || 0);
Condition50%1/2
$this || 0
l!l
280
MC/DC0%0/1
$this || 0
$this
Truth table50%1/2
A
A= $this
Aresult
11
00
1381 28 ▶ croak("invalid date/time") unless ($this->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
unless $this->is_valid 0 28 28
1382 }
1383 0 else { croak("illegal operand type"); }
1384 449 $val1 = $self->is_date();
1385 449 $val2 = $this->is_date();
1386 449 ▶ if ($code == 6 or $code == 5)
Branch: 2 branches
BranchTrueFalseTotal
if ($code == 6 or $code == 5) { } 242 207 449
elsif ($code <= 4 and $code >= 1) { } 207 0 207
Condition100%3/3
$code == 6 or $code == 5
l!l&&r!l&&!r
123119207
MC/DC100%2/2
$code == 6 or $code == 5
$code == 6 $code == 5
Truth table100%3/3
A or B
A= $code == 6B= $code == 5
ABresult
1X1
011
000
1387 {
1388 242 ▶ if ($code == 6)
Branch: 1 branch
BranchTrueFalseTotal
if ($code == 6) { } 123 119 242
1389 {
1390 123 ▶ croak("can't subtract a date from a delta vector")
Branch: 1 branch
BranchTrueFalseTotal
if not $val1 and $val2 and not $flag or $val1 and not $val2 and $flag 0 123 123
Condition60%9/15
not $val1 and $val2 and not $flag or $val1 and not $val2 and $flag
l!l&&r!l&&!r
00123
not $val1 and $val2 and not $flag
!ll&&!rl&&r
12300
not $val1 and $val2
!ll&&!rl&&r
12210
$val1 and not $val2 and $flag
!ll&&!rl&&r
101220
$val1 and not $val2
!ll&&!rl&&r
110022
MC/DC0%0/6
not $val1 and $val2 and not $flag or $val1 and not $val2 and $flag
not $val1 $val2 not $flag $val1 not $val2 $flag
Truth table23%3/13
not(A) and B and not(C) or D and not(E) and F
A= not $val1B= $val2C= not $flagD= $val1E= not $val2F= $flag
ABCDEFresult
111XXX1
0XX1111
10X1111
1101111
0XX0XX0
0XX10X0
0XX1100
10X0XX0
10X10X0
10X1100
1100XX0
11010X0
1101100
1391 if ((not $val1 and $val2 and not $flag) or
1392 ($val1 and not $val2 and $flag));
1393 }
1394 else
1395 {
1396 119 ▶ croak("can't add two dates")
Branch: 1 branch
BranchTrueFalseTotal
if $val1 and $val2 2 117 119
Condition100%3/3
$val1 and $val2
!ll&&!rl&&r
19982
MC/DC100%2/2
$val1 and $val2
$val1 $val2
Truth table100%3/3
A and B
A= $val1B= $val2
ABresult
0X0
100
111
1397 if ($val1 and $val2);
1398 }
1399 240 $len1 = $self->is_long();
1400 240 $len2 = $this->is_long();
1401 240 ▶ if ($len1 or $len2) { $last = 7; }
Branch: 1 branch
BranchTrueFalseTotal
if ($len1 or $len2) { } 94 146 240
Condition100%3/3
$len1 or $len2
l!l&&r!l&&!r
931146
MC/DC100%2/2
$len1 or $len2
$len1 $len2
Truth table100%3/3
A or B
A= $len1B= $len2
ABresult
1X1
011
000
1402 146 else { $last = 4; }
1403 240 ▶ if (defined $flag) { $result = $self->new((0) x $last); }
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 188 52 240
1404 52 else { $result = $self; }
1405 240 ▶ if (not $val1 and not $val2)
Branch: 1 branch
BranchTrueFalseTotal
unless ($val1 or $val2) 2 238 240
Condition100%3/3
$val1 or $val2
l!l&&r!l&&!r
220182
MC/DC100%2/2
$val1 or $val2
$val1 $val2
Truth table100%3/3
A or B
A= $val1B= $val2
ABresult
1X1
011
000
1406 {
1407 2 $result->[0][0] = 1;
1408 2 ▶ for ( $item = 1; $item < $last; $item++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($item < $last) 12 2 14
1409 {
1410 12 ▶ if ($code == 6)
Branch: 1 branch
BranchTrueFalseTotal
if ($code == 6) { } 6 6 12
1411 {
1412 6 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 6 6
1413 {
1414 0 ▶ $result->[$item] =
Condition0%0/4
$this->[$item] || 0
l!l
00
$self->[$item] || 0
l!l
00
MC/DC0%0/1
$this->[$item] || 0
$this->[$item]
MC/DC0%0/1
$self->[$item] || 0
$self->[$item]
Truth table0%0/2
A
A= $this->[$item]
Aresult
11
00
Truth table0%0/2
A
A= $self->[$item]
Aresult
11
00
1415 ($this->[$item] || 0) -
1416 ($self->[$item] || 0);
1417 }
1418 else
1419 {
1420 6 ▶ $result->[$item] =
Condition75%3/4
$self->[$item] || 0
l!l
60
$this->[$item] || 0
l!l
42
MC/DC0%0/1
$self->[$item] || 0
$self->[$item]
MC/DC100%1/1
$this->[$item] || 0
$this->[$item]
Truth table50%1/2
A
A= $self->[$item]
Aresult
11
00
Truth table100%2/2
A
A= $this->[$item]
Aresult
11
00
1421 ($self->[$item] || 0) -
1422 ($this->[$item] || 0);
1423 }
1424 }
1425 else
1426 {
1427 6 ▶ $result->[$item] =
Condition75%3/4
$self->[$item] || 0
l!l
60
$this->[$item] || 0
l!l
42
MC/DC0%0/1
$self->[$item] || 0
$self->[$item]
MC/DC100%1/1
$this->[$item] || 0
$this->[$item]
Truth table50%1/2
A
A= $self->[$item]
Aresult
11
00
Truth table100%2/2
A
A= $this->[$item]
Aresult
11
00
1428 ($self->[$item] || 0) +
1429 ($this->[$item] || 0);
1430 }
1431 }
1432 }
1433 240 return ($result,$this,$val1,$val2,$len1,$len2);
1434 }
1435 ▶ elsif ($code <= 4 and $code >= 1)
Condition33%1/3
$code <= 4 and $code >= 1
!ll&&!rl&&r
00207
MC/DC0%0/2
$code <= 4 and $code >= 1
$code <= 4 $code >= 1
Truth table33%1/3
A and B
A= $code <= 4B= $code >= 1
ABresult
0X0
100
111
1436 {
1437 207 ▶ croak("can't compare a date and a delta vector")
Branch: 1 branch
BranchTrueFalseTotal
if $val1 xor $val2 0 207 207
Condition50%2/4
$val1 xor $val2
l&&rl&&!r!l&&r!l&&!r
1250082
MC/DC0%0/2
$val1 xor $val2
$val1 $val2
Truth table50%2/4
A xor B
A= $val1B= $val2
ABresult
110
101
011
000
1438 if ($val1 xor $val2);
1439 207 ▶ if ($code >= 3)
Branch: 1 branch
BranchTrueFalseTotal
if ($code >= 3) { } 204 3 207
1440 {
1441 204 ▶ if ($code == 4) { $last = 7; }
Branch: 1 branch
BranchTrueFalseTotal
if ($code == 4) { } 165 39 204
1442 39 else { $last = 4; }
1443 204 $result = 1;
1444 ITEM:
1445 204 ▶ for ( $item = 1; $item < $last; $item++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($item < $last) 1107 204 1311
1446 {
1447 1107 ▶ if (($self->[$item] || 0) !=
Branch: 1 branch
BranchTrueFalseTotal
if (($self->[$item] || 0) != ($this->[$item] || 0)) 0 1107 1107
Condition100%4/4
$self->[$item] || 0
l!l
665442
$this->[$item] || 0
l!l
665442
MC/DC100%1/1
$self->[$item] || 0
$self->[$item]
MC/DC100%1/1
$this->[$item] || 0
$this->[$item]
Truth table100%2/2
A
A= $self->[$item]
Aresult
11
00
Truth table100%2/2
A
A= $this->[$item]
Aresult
11
00
1448 ($this->[$item] || 0))
1449 0 { $result = 0; last ITEM; }
1450 }
1451 204 return $result;
1452 }
1453 else # ($code <= 2)
1454 {
1455 # croak("can't compare two delta vectors")
1456 # if (not $val1 and not $val2);
1457 3 ▶ if ($code == 2)
Branch: 1 branch
BranchTrueFalseTotal
if ($code == 2) { } 3 0 3
1458 {
1459 3 $len1 = $self->number();
1460 3 $len2 = $this->number();
1461 }
1462 else
1463 {
1464 0 $len1 = int($self->number());
1465 0 $len2 = int($this->number());
1466 }
1467 0 ▶ if ($flag) { return $len2 <=> $len1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 3 3
1468 3 else { return $len1 <=> $len2; }
1469 }
1470 }
1471 0 else { croak("unexpected internal error; please contact author"); }
1472 }
1473  
1474 sub _unary_minus_
1475 0 ▶{
Subroutine _unary_minus_: not called CC=1 SCAR=6.9
1476 0 my($self,$this,$flag) = @_;
1477  
1478 0 return $self->_process_($this,$flag,0);
1479 }
1480  
1481 sub _compare_date_
1482 0 ▶{
Subroutine _compare_date_: not called CC=1 SCAR=6.9
1483 0 my($self,$this,$flag) = @_;
1484  
1485 0 return $self->_process_($this,$flag,1);
1486 }
1487  
1488 sub _compare_date_time_
1489 3 ▶{
Subroutine _compare_date_time_: called CC=1 SCAR=0.0
1490 3 my($self,$this,$flag) = @_;
1491  
1492 3 return $self->_process_($this,$flag,2);
1493 }
1494  
1495 sub _equal_date_
1496 39 ▶{
Subroutine _equal_date_: called CC=1 SCAR=0.0
1497 39 my($self,$this,$flag) = @_;
1498  
1499 39 return $self->_process_($this,$flag,3);
1500 }
1501  
1502 sub _not_equal_date_
1503 0 ▶{
Subroutine _not_equal_date_: not called CC=1 SCAR=6.9
1504 0 my($self,$this,$flag) = @_;
1505  
1506 0 return $self->_process_($this,$flag,3) ^ 1;
1507 }
1508  
1509 sub _equal_date_time_
1510 165 ▶{
Subroutine _equal_date_time_: called CC=1 SCAR=0.0
1511 165 my($self,$this,$flag) = @_;
1512  
1513 165 return $self->_process_($this,$flag,4);
1514 }
1515  
1516 sub _not_equal_date_time_
1517 0 ▶{
Subroutine _not_equal_date_time_: not called CC=1 SCAR=6.9
1518 0 my($self,$this,$flag) = @_;
1519  
1520 0 return $self->_process_($this,$flag,4) ^ 1;
1521 }
1522  
1523 sub _date_time_
1524 184 ▶{
Subroutine _date_time_: called CC=2 SCAR=6.9
1525 184 my($self) = @_;
1526  
1527 184 ▶ if (@{$self} == 7) { return (@{$self}[1..6]); }
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self;} == 7) { } 175 9 184
1528 9 else { return (@{$self}[1..3],0,0,0); }
1529 }
1530  
1531 sub _add_
1532 138 ▶{
Subroutine _add_: called CC=16 SCAR=28.5
1533 138 my($result,$self,$this,$flag,$val1,$val2,$len1,$len2) = @_;
1534  
1535 138 ▶ if ($val1) # date + delta => date
Branch: 1 branch
BranchTrueFalseTotal
if ($val1) { } 120 18 138
1536 {
1537 120 ▶ if ($len1 or $len2)
Branch: 1 branch
BranchTrueFalseTotal
if ($len1 or $len2) { } 40 80 120
Condition66%2/3
$len1 or $len2
l!l&&r!l&&!r
40080
MC/DC50%1/2
$len1 or $len2
$len1 $len2
Truth table66%2/3
A or B
A= $len1B= $len2
ABresult
1X1
011
000
1538 {
1539 40 ▶ if (not $ACCURATE_MODE and $NORMALIZED_MODE)
Branch: 1 branch
BranchTrueFalseTotal
if (not $ACCURATE_MODE and $NORMALIZED_MODE) { } 40 0 40
Condition33%1/3
not $ACCURATE_MODE and $NORMALIZED_MODE
!ll&&!rl&&r
0040
MC/DC0%0/2
not $ACCURATE_MODE and $NORMALIZED_MODE
not $ACCURATE_MODE $NORMALIZED_MODE
Truth table33%1/3
not(A) and B
A= not $ACCURATE_MODEB= $NORMALIZED_MODE
ABresult
0X0
100
111
1540 {
1541 40 splice( @{$result}, 1, 6,
1542 Add_N_Delta_YMDHMS( $self->_date_time_(),
1543 $this->_date_time_() ) );
1544 }
1545 else # ACCURATE_MODE or YMD_MODE
1546 {
1547 0 splice( @{$result}, 1, 6,
1548 Add_Delta_YMDHMS( $self->_date_time_(),
1549 $this->_date_time_() ) );
1550 }
1551 }
1552 else # short
1553 {
1554 80 ▶ if (not $ACCURATE_MODE and $NORMALIZED_MODE)
Branch: 1 branch
BranchTrueFalseTotal
if (not $ACCURATE_MODE and $NORMALIZED_MODE) { } 56 24 80
Condition100%3/3
not $ACCURATE_MODE and $NORMALIZED_MODE
!ll&&!rl&&r
22256
MC/DC100%2/2
not $ACCURATE_MODE and $NORMALIZED_MODE
not $ACCURATE_MODE $NORMALIZED_MODE
Truth table100%3/3
not(A) and B
A= not $ACCURATE_MODEB= $NORMALIZED_MODE
ABresult
0X0
100
111
1555 {
1556 56 splice( @{$result}, 1, 3,
1557 56 Add_N_Delta_YMD( @{$self}[1..3], @{$this}[1..3] ) );
1558 }
1559 else # ACCURATE_MODE or YMD_MODE
1560 {
1561 24 splice( @{$result}, 1, 3,
1562 24 Add_Delta_YMD( @{$self}[1..3], @{$this}[1..3] ) );
1563 }
1564 }
1565 }
1566 else # delta + date => date
1567 {
1568 18 ▶ if ($len1 or $len2)
Branch: 1 branch
BranchTrueFalseTotal
if ($len1 or $len2) { } 6 12 18
Condition66%2/3
$len1 or $len2
l!l&&r!l&&!r
6012
MC/DC50%1/2
$len1 or $len2
$len1 $len2
Truth table66%2/3
A or B
A= $len1B= $len2
ABresult
1X1
011
000
1569 {
1570 6 ▶ if (not $ACCURATE_MODE and $NORMALIZED_MODE)
Branch: 1 branch
BranchTrueFalseTotal
if (not $ACCURATE_MODE and $NORMALIZED_MODE) { } 0 6 6
Condition66%2/3
not $ACCURATE_MODE and $NORMALIZED_MODE
!ll&&!rl&&r
420
MC/DC0%0/2
not $ACCURATE_MODE and $NORMALIZED_MODE
not $ACCURATE_MODE $NORMALIZED_MODE
Truth table66%2/3
not(A) and B
A= not $ACCURATE_MODEB= $NORMALIZED_MODE
ABresult
0X0
100
111
1571 {
1572 0 splice( @{$result}, 1, 6,
1573 Add_N_Delta_YMDHMS( $this->_date_time_(),
1574 $self->_date_time_() ) );
1575 }
1576 else # ACCURATE_MODE or YMD_MODE
1577 {
1578 6 splice( @{$result}, 1, 6,
1579 Add_Delta_YMDHMS( $this->_date_time_(),
1580 $self->_date_time_() ) );
1581 }
1582 }
1583 else # short
1584 {
1585 12 ▶ if (not $ACCURATE_MODE and $NORMALIZED_MODE)
Branch: 1 branch
BranchTrueFalseTotal
if (not $ACCURATE_MODE and $NORMALIZED_MODE) { } 6 6 12
Condition66%2/3
not $ACCURATE_MODE and $NORMALIZED_MODE
!ll&&!rl&&r
066
MC/DC50%1/2
not $ACCURATE_MODE and $NORMALIZED_MODE
not $ACCURATE_MODE $NORMALIZED_MODE
Truth table66%2/3
not(A) and B
A= not $ACCURATE_MODEB= $NORMALIZED_MODE
ABresult
0X0
100
111
1586 {
1587 6 splice( @{$result}, 1, 3,
1588 6 Add_N_Delta_YMD( @{$this}[1..3], @{$self}[1..3] ) );
1589 }
1590 else # ACCURATE_MODE or YMD_MODE
1591 {
1592 6 splice( @{$result}, 1, 3,
1593 6 Add_Delta_YMD( @{$this}[1..3], @{$self}[1..3] ) );
1594 }
1595 }
1596 18 ▶ carp("implicitly changed object type from delta vector to date")
Branch: 1 branch
BranchTrueFalseTotal
if not defined $flag and $^W 4 14 18
Condition100%3/3
not defined $flag and $^W
!ll&&!rl&&r
1224
MC/DC100%2/2
not defined $flag and $^W
not defined $flag $^W
Truth table100%3/3
not(A) and B
A= not defined $flagB= $^W
ABresult
0X0
100
111
1597 if (not defined $flag and $^W);
1598 }
1599 138 $result->[0][0] = 0;
1600 }
1601  
1602 sub _plus_
1603 119 ▶{
Subroutine _plus_: called CC=3 SCAR=11.0
1604 119 my($self,$this,$flag) = @_;
1605 119 my($result,$val1,$val2,$len1,$len2);
1606  
1607 119 ($result,$this,$val1,$val2,$len1,$len2) = $self->_process_($this,$flag,5);
1608 117 ▶ if ($val1 or $val2)
Branch: 1 branch
BranchTrueFalseTotal
if ($val1 or $val2) 116 1 117
Condition100%3/3
$val1 or $val2
l!l&&r!l&&!r
98181
MC/DC100%2/2
$val1 or $val2
$val1 $val2
Truth table100%3/3
A or B
A= $val1B= $val2
ABresult
1X1
011
000
1609 {
1610 116 $result->_add_($self,$this,$flag,$val1,$val2,$len1,$len2);
1611 }
1612 117 return $result;
1613 }
1614  
1615 sub _minus_
1616 125 ▶{
Subroutine _minus_: called CC=22 SCAR=35.8
1617 125 my($self,$this,$flag) = @_;
1618 125 my($result,$val1,$val2,$len1,$len2,$temp,$item);
1619  
1620 125 ($result,$this,$val1,$val2,$len1,$len2) = $self->_process_($this,$flag,6);
1621 123 ▶ if ($val1 or $val2)
Branch: 1 branch
BranchTrueFalseTotal
if ($val1 or $val2) 122 1 123
Condition66%2/3
$val1 or $val2
l!l&&r!l&&!r
12201
MC/DC50%1/2
$val1 or $val2
$val1 $val2
Truth table66%2/3
A or B
A= $val1B= $val2
ABresult
1X1
011
000
1622 {
1623 122 ▶ if ($val1 and $val2) # date - date => delta
Branch: 1 branch
BranchTrueFalseTotal
if ($val1 and $val2) { } 100 22 122
Condition66%2/3
$val1 and $val2
!ll&&!rl&&r
022100
MC/DC50%1/2
$val1 and $val2
$val1 $val2
Truth table66%2/3
A and B
A= $val1B= $val2
ABresult
0X0
100
111
1624 {
1625 100 ▶ if ($len1 or $len2)
Branch: 1 branch
BranchTrueFalseTotal
if ($len1 or $len2) { } 46 54 100
Condition100%3/3
$len1 or $len2
l!l&&r!l&&!r
45154
MC/DC100%2/2
$len1 or $len2
$len1 $len2
Truth table100%3/3
A or B
A= $len1B= $len2
ABresult
1X1
011
000
1626 {
1627 46 ▶ if ($ACCURATE_MODE)
Branch: 1 branch
BranchTrueFalseTotal
if ($ACCURATE_MODE) { } 3 43 46
1628 {
1629 3 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 3 3
1630 {
1631 0 splice( @{$result}, 1, 6, 0, 0,
1632 Delta_DHMS( $self->_date_time_(),
1633 $this->_date_time_() ) );
1634 }
1635 else
1636 {
1637 3 splice( @{$result}, 1, 6, 0, 0,
1638 Delta_DHMS( $this->_date_time_(),
1639 $self->_date_time_() ) );
1640 }
1641 }
1642 else # YMD_MODE or N_YMD_MODE
1643 {
1644 43 ▶ if ($NORMALIZED_MODE) # N_YMD_MODE
Branch: 1 branch
BranchTrueFalseTotal
if ($NORMALIZED_MODE) { } 40 3 43
1645 {
1646 40 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 40 40
1647 {
1648 0 splice( @{$result}, 1, 6,
1649 N_Delta_YMDHMS( $self->_date_time_(),
1650 $this->_date_time_() ) );
1651 }
1652 else
1653 {
1654 40 splice( @{$result}, 1, 6,
1655 N_Delta_YMDHMS( $this->_date_time_(),
1656 $self->_date_time_() ) );
1657 }
1658 }
1659 else # YMD_MODE
1660 {
1661 3 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 3 3
1662 {
1663 0 splice( @{$result}, 1, 6,
1664 Delta_YMDHMS( $self->_date_time_(),
1665 $this->_date_time_() ) );
1666 }
1667 else
1668 {
1669 3 splice( @{$result}, 1, 6,
1670 Delta_YMDHMS( $this->_date_time_(),
1671 $self->_date_time_() ) );
1672 }
1673 }
1674 }
1675 }
1676 else # short
1677 {
1678 54 ▶ if ($ACCURATE_MODE)
Branch: 1 branch
BranchTrueFalseTotal
if ($ACCURATE_MODE) { } 10 44 54
1679 {
1680 10 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 10 10
1681 {
1682 0 splice( @{$result}, 1, 3, 0, 0,
1683 0 Delta_Days( @{$self}[1..3], @{$this}[1..3] ) );
1684 }
1685 else
1686 {
1687 10 splice( @{$result}, 1, 3, 0, 0,
1688 10 Delta_Days( @{$this}[1..3], @{$self}[1..3] ) );
1689 }
1690 }
1691 else # YMD_MODE or N_YMD_MODE
1692 {
1693 44 ▶ if ($NORMALIZED_MODE) # N_YMD_MODE
Branch: 1 branch
BranchTrueFalseTotal
if ($NORMALIZED_MODE) { } 39 5 44
1694 {
1695 39 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 39 39
1696 {
1697 0 splice( @{$result}, 1, 3,
1698 0 N_Delta_YMD( @{$self}[1..3], @{$this}[1..3] ) );
1699 }
1700 else
1701 {
1702 39 splice( @{$result}, 1, 3,
1703 39 N_Delta_YMD( @{$this}[1..3], @{$self}[1..3] ) );
1704 }
1705 }
1706 else # YMD_MODE
1707 {
1708 5 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 5 5
1709 {
1710 0 splice( @{$result}, 1, 3,
1711 0 Delta_YMD( @{$self}[1..3], @{$this}[1..3] ) );
1712 }
1713 else
1714 {
1715 5 splice( @{$result}, 1, 3,
1716 5 Delta_YMD( @{$this}[1..3], @{$self}[1..3] ) );
1717 }
1718 }
1719 }
1720 }
1721 100 ▶ carp("implicitly changed object type from date to delta vector")
Branch: 1 branch
BranchTrueFalseTotal
if not defined $flag and $^W 2 98 100
Condition100%3/3
not defined $flag and $^W
!ll&&!rl&&r
9622
MC/DC100%2/2
not defined $flag and $^W
not defined $flag $^W
Truth table100%3/3
not(A) and B
A= not defined $flagB= $^W
ABresult
0X0
100
111
1722 if (not defined $flag and $^W);
1723 100 $result->[0][0] = 1;
1724 }
1725 else # date - delta => date
1726 {
1727 22 ▶ if ($val1)
Branch: 1 branch
BranchTrueFalseTotal
if ($val1) { } 22 0 22
1728 {
1729 22 $temp = $this->new();
1730 22 $temp->[0][0] = $this->[0][0];
1731 22 ▶ for ( $item = 1; $item < @{$this}; $item++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($item < @{$this;}) 66 22 88
1732 {
1733 66 $temp->[$item] = -$this->[$item];
1734 }
1735 22 $result->_add_($self,$temp,$flag,$val1,$val2,$len1,$len2);
1736 }
1737 else
1738 {
1739 0 $temp = $self->new();
1740 0 $temp->[0][0] = $self->[0][0];
1741 0 ▶ for ( $item = 1; $item < @{$self}; $item++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($item < @{$self;}) 0 0 0
1742 {
1743 0 $temp->[$item] = -$self->[$item];
1744 }
1745 0 $result->_add_($temp,$this,$flag,$val1,$val2,$len1,$len2);
1746 }
1747 }
1748 }
1749 123 return $result;
1750 }
1751  
1752 sub _plus_equal_
1753 21 ▶{
Subroutine _plus_equal_: called CC=1 SCAR=0.0
1754 21 my($self,$this) = @_;
1755  
1756 21 return $self->_plus_($this,undef);
1757 }
1758  
1759 sub _minus_equal_
1760 18 ▶{
Subroutine _minus_equal_: called CC=1 SCAR=0.0
1761 18 my($self,$this) = @_;
1762  
1763 18 return $self->_minus_($this,undef);
1764 }
1765  
1766 sub _increment_
1767 8 ▶{
Subroutine _increment_: called CC=1 SCAR=0.0
1768 8 my($self) = @_;
1769  
1770 8 return $self->_plus_(1,undef);
1771 }
1772  
1773 sub _decrement_
1774 8 ▶{
Subroutine _decrement_: called CC=1 SCAR=0.0
1775 8 my($self) = @_;
1776  
1777 8 return $self->_minus_(1,undef);
1778 }
1779  
1780 15 1;
1781  
1782 __END__
« Calc/PP.pm ↑ Summary Calendar/Year.pm »