| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Parse::Crontab::Entry::Job; |
|
2
|
3
|
|
|
3
|
|
39536
|
use strict; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
12555
|
|
|
3
|
3
|
|
|
3
|
|
24
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
88
|
|
|
4
|
3
|
|
|
3
|
|
5038
|
use Try::Tiny; |
|
|
3
|
|
|
|
|
5430
|
|
|
|
3
|
|
|
|
|
195
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
898
|
use Mouse; |
|
|
3
|
|
|
|
|
55728
|
|
|
|
3
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
|
|
extends 'Parse::Crontab::Entry'; |
|
8
|
3
|
|
|
3
|
|
4076
|
use Parse::Crontab::Schedule; |
|
|
3
|
|
|
|
|
222
|
|
|
|
3
|
|
|
|
|
254
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has command => ( |
|
11
|
|
|
|
|
|
|
is => 'rw', |
|
12
|
|
|
|
|
|
|
isa => 'Str', |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has schedule => ( |
|
16
|
|
|
|
|
|
|
is => 'rw', |
|
17
|
|
|
|
|
|
|
isa => 'Parse::Crontab::Schedule', |
|
18
|
|
|
|
|
|
|
handles => [qw/minute hour day month day_of_week definition user/], |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has has_user_field => ( |
|
22
|
|
|
|
|
|
|
is => 'ro', |
|
23
|
|
|
|
|
|
|
isa => 'Bool', |
|
24
|
|
|
|
|
|
|
default => undef, |
|
25
|
|
|
|
|
|
|
); |
|
26
|
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
|
18
|
no Mouse; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
19
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub BUILD { |
|
30
|
10
|
|
|
10
|
1
|
19
|
my $self = shift; |
|
31
|
|
|
|
|
|
|
|
|
32
|
10
|
|
|
|
|
47
|
my $line = $self->line; |
|
33
|
10
|
|
|
|
|
16
|
my $definition; |
|
34
|
|
|
|
|
|
|
my $command; |
|
35
|
0
|
|
|
|
|
0
|
my $user; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
my %args; |
|
38
|
10
|
100
|
|
|
|
54
|
if (($definition) = $line =~ /^@([^\s]+)/) { |
|
39
|
|
|
|
|
|
|
|
|
40
|
4
|
100
|
|
|
|
20
|
if ($self->has_user_field) { |
|
41
|
1
|
|
|
|
|
5
|
($user, $command) = (split /\s+/, $line, 3)[1,2]; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
else { |
|
44
|
3
|
|
|
|
|
13
|
$command = (split /\s+/, $line, 2)[1]; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
4
|
|
|
|
|
19
|
%args = ( |
|
48
|
|
|
|
|
|
|
definition => $definition, |
|
49
|
|
|
|
|
|
|
user => $user, |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
else { |
|
53
|
6
|
100
|
|
|
|
37
|
my $entity_num = $self->has_user_field ? 7 : 6; |
|
54
|
6
|
|
|
|
|
30
|
my @entities = split /\s+/, $line, $entity_num; |
|
55
|
6
|
|
|
|
|
11
|
my ($min, $hour, $day, $month, $dow, $com); |
|
56
|
|
|
|
|
|
|
|
|
57
|
6
|
100
|
|
|
|
22
|
if ($self->has_user_field) { |
|
58
|
1
|
|
|
|
|
4
|
($min, $hour, $day, $month, $dow, $user, $com) = @entities; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
else { |
|
61
|
5
|
|
|
|
|
18
|
($min, $hour, $day, $month, $dow, $com) = @entities; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
6
|
100
|
|
|
|
21
|
unless ($com) { |
|
64
|
1
|
|
|
|
|
15
|
$self->set_error(sprintf '[%s] is not valid cron job', $self->line); |
|
65
|
1
|
|
|
|
|
5
|
return; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
5
|
|
|
|
|
8
|
$command = $com; |
|
68
|
5
|
|
|
|
|
52
|
%args = ( |
|
69
|
|
|
|
|
|
|
minute => $min, |
|
70
|
|
|
|
|
|
|
hour => $hour, |
|
71
|
|
|
|
|
|
|
day => $day, |
|
72
|
|
|
|
|
|
|
month => $month, |
|
73
|
|
|
|
|
|
|
day_of_week => $dow, |
|
74
|
|
|
|
|
|
|
user => $user, |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
9
|
50
|
|
|
|
27
|
unless ($command) { |
|
79
|
0
|
|
|
|
|
0
|
$self->set_error(sprintf '[%s] is not valid cron job', $self->line); |
|
80
|
0
|
|
|
|
|
0
|
return; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
9
|
|
|
|
|
35
|
$self->command($command); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
try { |
|
85
|
9
|
|
|
9
|
|
456
|
$self->schedule(Parse::Crontab::Schedule->new(%args)); |
|
86
|
|
|
|
|
|
|
|
|
87
|
8
|
|
|
|
|
58
|
my @warnings = $self->schedule->_check_warnings; |
|
88
|
8
|
|
|
|
|
51
|
$self->set_warning($_) for @warnings; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
catch { |
|
91
|
1
|
|
|
1
|
|
84
|
$self->set_error(sprintf 'schedule error! %s', $_); |
|
92
|
9
|
|
|
|
|
91
|
}; |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |