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