line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
require Exporter; |
3
|
|
|
|
|
|
|
our @EXPORT_OK = qw( params_check ); |
4
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use File::Spec; |
7
|
70
|
|
|
70
|
|
428
|
|
|
70
|
|
|
|
|
119
|
|
|
70
|
|
|
|
|
27252
|
|
8
|
|
|
|
|
|
|
########################################### |
9
|
|
|
|
|
|
|
########################################### |
10
|
|
|
|
|
|
|
my( $hash, $required, $optional ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
13
|
|
|
13
|
0
|
24
|
my $pkg = caller(); |
13
|
|
|
|
|
|
|
my %hash_copy = %$hash; |
14
|
13
|
|
|
|
|
25
|
|
15
|
13
|
|
|
|
|
38
|
if( defined $required ) { |
16
|
|
|
|
|
|
|
for my $p ( @$required ) { |
17
|
13
|
50
|
|
|
|
29
|
if( !exists $hash->{ $p } or |
18
|
13
|
|
|
|
|
19
|
!defined $hash->{ $p } ) { |
19
|
16
|
50
|
33
|
|
|
58
|
die "$pkg: Required parameter $p missing."; |
20
|
|
|
|
|
|
|
} |
21
|
0
|
|
|
|
|
0
|
delete $hash_copy{ $p }; |
22
|
|
|
|
|
|
|
} |
23
|
16
|
|
|
|
|
29
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
if( defined $optional ) { |
26
|
|
|
|
|
|
|
for my $p ( @$optional ) { |
27
|
13
|
100
|
|
|
|
27
|
delete $hash_copy{ $p }; |
28
|
12
|
|
|
|
|
15
|
} |
29
|
24
|
|
|
|
|
33
|
if( scalar keys %hash_copy ) { |
30
|
|
|
|
|
|
|
die "$pkg: Unknown parameter: ", join( ",", keys %hash_copy ); |
31
|
12
|
100
|
|
|
|
35
|
} |
32
|
1
|
|
|
|
|
18
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
################################################## |
36
|
|
|
|
|
|
|
################################################## |
37
|
|
|
|
|
|
|
my($full_name) = @_; |
38
|
|
|
|
|
|
|
# Weird cases like "strict;" (including the semicolon) would |
39
|
|
|
|
|
|
|
# succeed with the eval below, so check those up front. |
40
|
565
|
|
|
565
|
0
|
1178
|
# I can't believe Perl doesn't have a proper way to check if a |
41
|
|
|
|
|
|
|
# module is available or not! |
42
|
|
|
|
|
|
|
return 0 if $full_name =~ /[^\w:]/; |
43
|
|
|
|
|
|
|
$full_name =~ s#::#/#g; |
44
|
|
|
|
|
|
|
$full_name .= '.pm'; |
45
|
565
|
100
|
|
|
|
1985
|
return 1 if $INC{$full_name}; |
46
|
563
|
|
|
|
|
1952
|
eval { |
47
|
563
|
|
|
|
|
1037
|
local $SIG{__DIE__} = sub {}; |
48
|
563
|
100
|
|
|
|
2243
|
require $full_name; |
49
|
131
|
|
|
|
|
233
|
}; |
50
|
131
|
|
|
37
|
|
916
|
return !$@; |
51
|
131
|
|
|
|
|
48954
|
} |
52
|
|
|
|
|
|
|
|
53
|
131
|
|
|
|
|
85378
|
################################################## |
54
|
|
|
|
|
|
|
################################################## |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $name = File::Spec->catfile(File::Spec->tmpdir(), |
57
|
|
|
|
|
|
|
'l4p-tmpfile-' . |
58
|
|
|
|
|
|
|
"$$-" . |
59
|
|
|
|
|
|
|
int(rand(9999999))); |
60
|
1
|
|
|
1
|
0
|
163
|
|
61
|
|
|
|
|
|
|
# Some crazy versions of File::Spec use backslashes on Win32 |
62
|
|
|
|
|
|
|
$name =~ s#\\#/#g; |
63
|
|
|
|
|
|
|
return $name; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
6
|
1; |
67
|
1
|
|
|
|
|
3
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=encoding utf8 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 NAME |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Log::Log4perl::Util - Internal utility functions |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Only internal functions here. Don't peek. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 LICENSE |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Copyright 2002-2013 by Mike Schilli E<lt>m@perlmeister.comE<gt> |
82
|
|
|
|
|
|
|
and Kevin Goess E<lt>cpan@goess.orgE<gt>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
85
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 AUTHOR |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Please contribute patches to the project on Github: |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
http://github.com/mschilli/log4perl |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Send bug reports or requests for enhancements to the authors via our |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
MAILING LIST (questions, bug reports, suggestions/patches): |
96
|
|
|
|
|
|
|
log4perl-devel@lists.sourceforge.net |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Authors (please contact them via the list above, not directly): |
99
|
|
|
|
|
|
|
Mike Schilli <m@perlmeister.com>, |
100
|
|
|
|
|
|
|
Kevin Goess <cpan@goess.org> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Contributors (in alphabetical order): |
103
|
|
|
|
|
|
|
Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp, Hutton |
104
|
|
|
|
|
|
|
Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony |
105
|
|
|
|
|
|
|
Foiani, James FitzGibbon, Carl Franks, Dennis Gregorovic, Andy |
106
|
|
|
|
|
|
|
Grundman, Paul Harrington, Alexander Hartmaier David Hull, |
107
|
|
|
|
|
|
|
Robert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, |
108
|
|
|
|
|
|
|
Brett Rann, Peter Rabbitson, Erik Selberg, Aaron Straup Cope, |
109
|
|
|
|
|
|
|
Lars Thegler, David Viner, Mac Yang. |
110
|
|
|
|
|
|
|
|