line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::ger::Plugin; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
2907
|
use strict; |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
206
|
|
4
|
8
|
|
|
8
|
|
38
|
use warnings; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
198
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
728
|
use Log::ger::Util; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
2584
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $DATE = '2022-06-10'; # DATE |
10
|
|
|
|
|
|
|
our $DIST = 'Log-ger'; # DIST |
11
|
|
|
|
|
|
|
our $VERSION = '0.040'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub set { |
14
|
18
|
|
|
18
|
0
|
10030
|
my $pkg = shift; |
15
|
|
|
|
|
|
|
|
16
|
18
|
|
|
|
|
30
|
my %args; |
17
|
18
|
100
|
|
|
|
61
|
if (ref $_[0] eq 'HASH') { |
18
|
2
|
|
|
|
|
3
|
%args = %{shift()}; |
|
2
|
|
|
|
|
8
|
|
19
|
|
|
|
|
|
|
} else { |
20
|
16
|
|
|
|
|
71
|
%args = (name => shift, conf => {@_}); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
18
|
|
33
|
|
|
125
|
$args{prefix} ||= $pkg . '::'; |
24
|
18
|
|
|
|
|
68
|
$args{replace_package_regex} = $pkg->_replace_package_regex; |
25
|
18
|
|
|
|
|
87
|
Log::ger::Util::set_plugin(%args); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub set_for_current_package { |
29
|
2
|
|
|
2
|
0
|
4
|
my $pkg = shift; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
3
|
my %args; |
32
|
2
|
50
|
|
|
|
7
|
if (ref $_[0] eq 'HASH') { |
33
|
0
|
|
|
|
|
0
|
%args = %{shift()}; |
|
0
|
|
|
|
|
0
|
|
34
|
|
|
|
|
|
|
} else { |
35
|
2
|
|
|
|
|
7
|
%args = (name => shift, conf => {@_}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
5
|
my $caller = caller(0); |
39
|
2
|
|
|
|
|
6
|
$args{target} = 'package'; |
40
|
2
|
|
|
|
|
3
|
$args{target_arg} = $caller; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
8
|
set($pkg, \%args); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
|
3
|
sub _import_sets_for_current_package { 0 } |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
2
|
|
5
|
sub _replace_package_regex { undef } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub import { |
50
|
3
|
50
|
|
3
|
|
41
|
if (@_ > 1) { |
51
|
3
|
100
|
|
|
|
11
|
if ($_[0]->_import_sets_for_current_package) { |
52
|
2
|
|
|
|
|
12
|
goto &set_for_current_package; |
53
|
|
|
|
|
|
|
} else { |
54
|
1
|
|
|
|
|
6
|
goto &set; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
# ABSTRACT: Use a plugin |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |