line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::ger::Format::Block; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-03-11'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Log-ger-Format-Block'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.008'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
75127
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
23
|
|
9
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
359
|
use Sub::Metadata qw(mutate_sub_prototype); |
|
1
|
|
|
|
|
420
|
|
|
1
|
|
|
|
|
150
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub meta { +{ |
14
|
2
|
|
|
2
|
0
|
1340
|
v => 2, |
15
|
|
|
|
|
|
|
} } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub get_hooks { |
18
|
2
|
|
|
2
|
0
|
20
|
my %plugin_conf = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return { |
21
|
|
|
|
|
|
|
create_formatter => [ |
22
|
|
|
|
|
|
|
__PACKAGE__, # key |
23
|
|
|
|
|
|
|
50, # priority |
24
|
|
|
|
|
|
|
sub { # hook |
25
|
3
|
|
|
3
|
|
468
|
my %hook_args = @_; # see Log::ger::Manual::Internals/"Arguments passed to hook" |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
|
|
8
|
my $formatter = sub { my $code = shift; $code->(@_) }; |
|
2
|
|
|
|
|
1178
|
|
|
2
|
|
|
|
|
12
|
|
28
|
3
|
|
|
|
|
9
|
[$formatter]; |
29
|
|
|
|
|
|
|
}], |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
before_install_routines => [ |
32
|
|
|
|
|
|
|
__PACKAGE__, # key |
33
|
|
|
|
|
|
|
50, # priority |
34
|
|
|
|
|
|
|
sub { # hook |
35
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
192
|
|
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
3
|
|
2428
|
my %hook_args = @_; # see Log::ger::Manual::Internals/"Arguments passed to hook" |
38
|
|
|
|
|
|
|
|
39
|
3
|
|
|
|
|
5
|
for my $r (@{ $hook_args{routines} }) { |
|
3
|
|
|
|
|
6
|
|
40
|
36
|
|
|
|
|
50
|
my ($coderef, $name, $lnum, $type) = @$r; |
41
|
36
|
100
|
|
|
|
83
|
next unless $type =~ /\Alog(ger)?_/; |
42
|
|
|
|
|
|
|
# avoid prototype mismatch warning when redefining |
43
|
18
|
50
|
33
|
|
|
33
|
if ($hook_args{target_type} eq 'package' || |
44
|
|
|
|
|
|
|
$hook_args{target_type} eq 'object') { |
45
|
18
|
100
|
|
|
|
18
|
if (defined ${"$hook_args{target_name}\::"}{$name}) { |
|
18
|
|
|
|
|
42
|
|
46
|
12
|
|
|
|
|
23
|
delete ${"$hook_args{target_name}\::"}{$name}; |
|
12
|
|
|
|
|
51
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
18
|
|
|
|
|
37
|
mutate_sub_prototype($coderef, '&'); |
50
|
|
|
|
|
|
|
} |
51
|
3
|
|
|
|
|
9
|
[1]; |
52
|
2
|
|
|
|
|
16
|
}], |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
# ABSTRACT: Use formatting using block instead of sprintf-style |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |