line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Log4perl::Warn::Multiple::EasyInit; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
49663
|
$Log::Log4perl::Warn::Multiple::EasyInit::DIST = 'Log-Log4perl-Warn-Multiple-EasyInit'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
1
|
|
|
1
|
|
24
|
$Log::Log4perl::Warn::Multiple::EasyInit::VERSION = '0.0.1'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: trap multiple calls to Log::Log4perl::easy_init |
9
|
1
|
|
|
1
|
|
25
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
10
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
56
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
8
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
126
|
|
13
|
1
|
|
|
1
|
|
1379
|
use Log::Log4perl; |
|
1
|
|
|
|
|
69901
|
|
|
1
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our ($package, $filename, $line); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub set_trap { |
18
|
1
|
|
|
1
|
0
|
4
|
my $code = \&Log::Log4perl::easy_init; |
19
|
1
|
|
|
1
|
|
116
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
155
|
|
20
|
|
|
|
|
|
|
*Log::Log4perl::easy_init = sub { |
21
|
4
|
100
|
|
4
|
|
14063
|
if(Log::Log4perl->initialized) { |
22
|
3
|
|
|
|
|
74
|
carp( "Log::Log4perl already initialised with easy_init() [at $filename, line $line]" ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
|
|
|
|
|
|
# store our first initialisation |
26
|
1
|
|
|
|
|
10
|
($package, $filename, $line) = caller; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
# run the original function |
29
|
4
|
|
|
|
|
1798
|
&$code($@); |
30
|
1
|
|
|
|
|
48
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
BEGIN { |
34
|
1
|
|
|
1
|
|
4
|
set_trap; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Log::Log4perl::Warn::Multiple::EasyInit - trap multiple calls to Log::Log4perl::easy_init |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 VERSION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
version 0.0.1 |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
BEGIN { |
53
|
|
|
|
|
|
|
use Log::Log4perl::Warn::Multiple::EasyInit; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Have you ever found yourself scratching your head wondering why your |
59
|
|
|
|
|
|
|
L output isn't going to the file(s) you expected? |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Often the culprit is a call to C somewhere in the landscape of |
62
|
|
|
|
|
|
|
modules being used. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
You could grep-hunt for the causes, or you could get your scripts and modules |
65
|
|
|
|
|
|
|
to keep an eye out for you. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 EXPERIMENTAL |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
B |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 EXAMPLE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 foo/multiple_init.pl |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This script uses the test libraries for the module: |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#!/usr/bin/env perl |
78
|
|
|
|
|
|
|
use strict; |
79
|
|
|
|
|
|
|
use warnings; |
80
|
|
|
|
|
|
|
use FindBin::libs; |
81
|
|
|
|
|
|
|
use lib "${FindBin::Bin}/../t/lib"; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
BEGIN { |
84
|
|
|
|
|
|
|
use Log::Log4perl::Warn::Multiple::EasyInit; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
use foo; |
88
|
|
|
|
|
|
|
use bar; |
89
|
|
|
|
|
|
|
use baz; |
90
|
|
|
|
|
|
|
use quux; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 Script Output |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Slightly reformatted for readability: |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Log::Log4perl already initialised with easy_init() |
97
|
|
|
|
|
|
|
[at /tmp/example/script/../t/lib/foo.pm, line 6] |
98
|
|
|
|
|
|
|
at /tmp/example/script/../t/lib/bar.pm line 6 |
99
|
|
|
|
|
|
|
Log::Log4perl already initialised with easy_init() |
100
|
|
|
|
|
|
|
[at /tmp/example/script/../t/lib/foo.pm, line 6] |
101
|
|
|
|
|
|
|
at /tmp/example/script/../t/lib/quux.pm line 6 |
102
|
|
|
|
|
|
|
Log::Log4perl already initialised with easy_init() |
103
|
|
|
|
|
|
|
[at /tmp/example/script/../t/lib/foo.pm, line 6] |
104
|
|
|
|
|
|
|
at /tmp/example/script/../t/lib/baz.pm line 8 |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Chisel Wright |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Chisel Wright. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
115
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |