line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
2071
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
116
|
|
2
|
5
|
|
|
5
|
|
21
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
193
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Footprintless::App::Command::log::follow; |
5
|
|
|
|
|
|
|
$Footprintless::App::Command::log::follow::VERSION = '1.26'; |
6
|
|
|
|
|
|
|
# ABSTRACT: output the last part of a file and append as the file grows |
7
|
|
|
|
|
|
|
# PODNAME: Footprintless::App::Command::log::follow |
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
26
|
use parent qw(Footprintless::App::Action); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
21
|
|
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
311
|
use Footprintless::App -ignore; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
25
|
|
12
|
5
|
|
|
5
|
|
800
|
use Log::Any; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
53
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $logger = Log::Any->get_logger(); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub execute { |
17
|
0
|
|
|
0
|
1
|
|
my ( $self, $opts, $args ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$self->{log}->follow( |
20
|
|
|
|
|
|
|
runner_options => { out_handle => \*STDOUT }, |
21
|
0
|
0
|
|
|
|
|
( $opts->{until} ? ( until => $opts->{until} ) : () ) |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
$logger->info('Done...'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub opt_spec { |
28
|
0
|
|
|
0
|
1
|
|
return ( [ 'until=s', 'a regex used to determine when to stop following the log' ] ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub usage_desc { |
32
|
0
|
|
|
0
|
1
|
|
return "fpl log LOG_COORD follow %o"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub validate_args { |
36
|
0
|
|
|
0
|
1
|
|
my ( $self, $opts, $args ) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
eval { $self->{log} = $self->{footprintless}->log( $self->{coordinate} ); }; |
|
0
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
$self->usage_error("invalid coordinate [$self->{coordinate}]: $@") if ($@); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |