line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RunCron::Reporter::File; |
2
|
3
|
|
|
3
|
|
1964
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
125
|
|
3
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
87
|
|
4
|
3
|
|
|
3
|
|
13
|
use utf8; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
24
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
76
|
use File::Path qw/mkpath/; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
287
|
|
7
|
3
|
|
|
3
|
|
19
|
use File::Basename qw/dirname/; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
258
|
|
8
|
3
|
|
|
3
|
|
3591
|
use Time::Piece; |
|
3
|
|
|
|
|
45345
|
|
|
3
|
|
|
|
|
16
|
|
9
|
3
|
|
|
3
|
|
239
|
use parent 'App::RunCron::Reporter'; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
34
|
|
10
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
11
|
3
|
|
|
|
|
53
|
ro => [qw/file/], |
12
|
3
|
|
|
3
|
|
260
|
); |
|
3
|
|
|
|
|
6
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
4
|
|
|
4
|
1
|
8
|
my $class = shift; |
16
|
4
|
100
|
|
|
|
16
|
my %args = @_ == 1 ? %{$_[0]} : @_; |
|
3
|
|
|
|
|
21
|
|
17
|
4
|
|
|
|
|
18
|
my $self = bless \%args, $class; |
18
|
|
|
|
|
|
|
|
19
|
4
|
100
|
|
|
|
19
|
defined $self->file or die 'file is required option'; |
20
|
3
|
|
|
|
|
66
|
$self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub run { |
24
|
2
|
|
|
2
|
0
|
4
|
my ($self, $runner) = @_; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
6
|
my $file = $self->file; |
27
|
2
|
|
|
|
|
20
|
my $now = localtime; |
28
|
2
|
|
|
|
|
389
|
$file = $now->strftime($file); |
29
|
2
|
|
|
|
|
343
|
my $dir = dirname($file); |
30
|
2
|
|
|
|
|
136
|
mkpath $dir; |
31
|
|
|
|
|
|
|
|
32
|
2
|
50
|
|
|
|
271
|
open my $fh, '>>', $file or die $!; |
33
|
2
|
|
|
|
|
12
|
print $fh '-'x78, "\n" . $runner->report; |
34
|
2
|
|
|
|
|
132
|
close $fh; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |