line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Chai::Util::ObjDisplay; |
2
|
5
|
|
|
5
|
|
72339
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
128
|
|
3
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
132
|
|
4
|
5
|
|
|
5
|
|
28
|
use utf8; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
34
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
124
|
use Exporter qw/import/; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
376
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/obj_display/; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $TRUNCATE_THRESHOLD = 40; |
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
470
|
use Test::Chai::Util::Inspect qw/inspect/; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1223
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub obj_display { |
14
|
623
|
|
|
623
|
0
|
1554
|
my $obj = shift; |
15
|
|
|
|
|
|
|
|
16
|
623
|
|
|
|
|
1421
|
my $str = inspect($obj); |
17
|
|
|
|
|
|
|
|
18
|
623
|
100
|
|
|
|
1234546
|
if (ref $obj eq 'CODE') { |
19
|
86
|
|
|
|
|
483
|
return '[Code]'; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
537
|
100
|
|
|
|
1351
|
if (length $str >= $TRUNCATE_THRESHOLD) { |
23
|
89
|
100
|
|
|
|
327
|
if (ref $obj eq 'ARRAY') { |
|
|
100
|
|
|
|
|
|
24
|
17
|
|
|
|
|
120
|
return '[ Array('.@$obj.') ]'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
elsif (ref $obj eq 'HASH') { |
28
|
28
|
|
|
|
|
109
|
my @keys = sort keys %$obj; |
29
|
28
|
100
|
|
|
|
110
|
my $kstr = @keys > 2 ? |
30
|
|
|
|
|
|
|
join(', ', @keys[0..1]).', ...' : join(', ', @keys); |
31
|
28
|
|
|
|
|
206
|
return '{ Hash ('.$kstr.') }'; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
else { |
35
|
44
|
|
|
|
|
269
|
return $str; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
else { |
40
|
448
|
|
|
|
|
2470
|
return $str; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |