line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Timestamper::Format::Filter::TS; |
2
|
|
|
|
|
|
|
$App::Timestamper::Format::Filter::TS::VERSION = '0.2.0'; |
3
|
1
|
|
|
1
|
|
95987
|
use strict; |
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
589
|
use POSIX qw/ strftime /; |
|
1
|
|
|
|
|
5139
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
2009
|
use App::Timestamper::Filter::TS; |
|
1
|
|
|
|
|
2347
|
|
|
1
|
|
|
|
|
202
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
11
|
|
|
|
|
|
|
{ |
12
|
1
|
|
|
1
|
1
|
106
|
return bless {}, shift; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub fh_filter |
16
|
|
|
|
|
|
|
{ |
17
|
1
|
|
|
1
|
1
|
4056
|
my ( $self, $in, $out ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
50
|
|
|
5
|
my $FMT = $ENV{'TIMESTAMPER_FORMAT'} // '%Y-%m-%d-%H:%M:%S'; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
10
|
my $filt = App::Timestamper::Filter::TS->new; |
22
|
|
|
|
|
|
|
$filt->fh_filter( |
23
|
|
|
|
|
|
|
$in, |
24
|
|
|
|
|
|
|
sub { |
25
|
4
|
|
|
4
|
|
1081
|
my ($l) = @_; |
26
|
4
|
|
|
|
|
32
|
return $out->( |
27
|
4
|
|
|
|
|
281
|
$l =~ s#\A([0-9\.]+)(\t)#strftime($FMT,localtime($1)).$2#er ); |
28
|
|
|
|
|
|
|
} |
29
|
1
|
|
|
|
|
12
|
); |
30
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
391
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |