| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Cron::Toolkit::Pattern::LastW; |
|
2
|
2
|
|
|
2
|
|
16
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
82
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
107
|
|
|
4
|
2
|
|
|
2
|
|
12
|
use parent 'Cron::Toolkit::Pattern'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub type { |
|
7
|
40
|
|
|
40
|
0
|
108
|
return 'lastW'; |
|
8
|
|
|
|
|
|
|
} |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub match { |
|
11
|
31
|
|
|
31
|
0
|
85
|
my ($self, $value, $tm) = @_; |
|
12
|
31
|
|
|
|
|
96
|
my $dom = $tm->day_of_month; |
|
13
|
31
|
|
|
|
|
80
|
my $days_in_month = $tm->length_of_month; |
|
14
|
31
|
|
|
|
|
46
|
my $candidate = $days_in_month; |
|
15
|
31
|
|
|
|
|
80
|
while ( $candidate >= 1 ) { |
|
16
|
31
|
|
|
|
|
101
|
my $test_tm = $tm->with_day_of_month($candidate); |
|
17
|
31
|
|
|
|
|
70
|
my $test_dow = $test_tm->day_of_week; |
|
18
|
31
|
50
|
33
|
|
|
163
|
if ( $test_dow >= 1 && $test_dow <= 5 ) { |
|
19
|
31
|
100
|
|
|
|
196
|
return $dom == $candidate ? 1 : 0; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
0
|
|
|
|
|
0
|
$candidate--; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
0
|
|
|
|
|
0
|
return 0; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub to_english { |
|
27
|
1
|
|
|
1
|
0
|
90
|
return 'on the last weekday'; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |