line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Log::Any::Adapter::Util; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Log::Any::Adapter::Util::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
} |
5
|
5
|
|
|
5
|
|
88479
|
use Data::Dumper; |
|
5
|
|
|
|
|
50523
|
|
|
5
|
|
|
|
|
397
|
|
6
|
5
|
|
|
5
|
|
46
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
159
|
|
7
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
44
|
|
|
5
|
|
|
|
|
168
|
|
8
|
5
|
|
|
5
|
|
24
|
use base qw(Exporter); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
1500
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
11
|
|
|
|
|
|
|
cmp_deeply |
12
|
|
|
|
|
|
|
dump_one_line |
13
|
|
|
|
|
|
|
make_method |
14
|
|
|
|
|
|
|
read_file |
15
|
|
|
|
|
|
|
require_dynamic |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub cmp_deeply { |
19
|
7
|
|
|
7
|
0
|
27
|
my ( $ref1, $ref2, $name ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
7
|
|
|
|
|
33
|
my $tb = Test::Builder->new(); |
22
|
7
|
|
|
|
|
110
|
$tb->is_eq( dump_one_line($ref1), dump_one_line($ref2), $name ); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub dump_one_line { |
26
|
14
|
|
|
14
|
0
|
575
|
my ($value) = @_; |
27
|
|
|
|
|
|
|
|
28
|
14
|
|
|
|
|
67
|
return Data::Dumper->new( [$value] )->Indent(0)->Sortkeys(1)->Quotekeys(0) |
29
|
|
|
|
|
|
|
->Terse(1)->Dump(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub make_method { |
33
|
105
|
|
|
105
|
0
|
165
|
my ( $method, $code, $pkg ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
105
|
|
66
|
|
|
319
|
$pkg ||= caller(); |
36
|
5
|
|
|
5
|
|
29
|
no strict 'refs'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
992
|
|
37
|
105
|
|
|
|
|
111
|
*{ $pkg . "::$method" } = $code; |
|
105
|
|
|
|
|
703
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub read_file { |
41
|
1
|
|
|
1
|
0
|
67
|
my ($file) = @_; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
7
|
local $/ = undef; |
44
|
1
|
50
|
|
|
|
47
|
open( my $fh, '<', $file ) |
45
|
|
|
|
|
|
|
or die "cannot open '$file': $!"; |
46
|
1
|
|
|
|
|
29
|
my $contents = <$fh>; |
47
|
1
|
|
|
|
|
25
|
return $contents; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub require_dynamic { |
51
|
15
|
|
|
15
|
0
|
24
|
my ($class) = @_; |
52
|
|
|
|
|
|
|
|
53
|
15
|
100
|
|
|
|
1057
|
unless ( defined( eval "require $class" ) ) |
54
|
|
|
|
|
|
|
{ ## no critic (ProhibitStringyEval) |
55
|
2
|
|
|
|
|
18
|
die $@; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |