line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Util; |
2
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
89
|
|
3
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
50
|
|
4
|
3
|
|
|
3
|
|
10
|
use utf8; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
15
|
|
5
|
3
|
|
|
3
|
|
76
|
use 5.010_001; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
115
|
|
6
|
3
|
|
|
3
|
|
14
|
use parent qw(Exporter); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
20
|
|
7
|
3
|
|
|
3
|
|
155
|
use Data::Dumper (); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
476
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw(dump_data truncstr); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub dump_data { |
12
|
0
|
|
|
0
|
0
|
|
my ($value) = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
0
|
|
|
|
|
unless (defined $value) { |
15
|
0
|
|
|
|
|
|
return '(undef)'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if (ref $value) { |
19
|
0
|
|
|
|
|
|
local $Data::Dumper::Terse = 1; |
20
|
0
|
|
|
|
|
|
local $Data::Dumper::Indent = 0; |
21
|
0
|
|
|
|
|
|
local $Data::Dumper::Sortkeys = 1; |
22
|
0
|
|
|
|
|
|
$value = Data::Dumper::Dumper($value); |
23
|
|
|
|
|
|
|
} |
24
|
0
|
|
|
|
|
|
$value =~ s/\n/\\n/g; |
25
|
0
|
|
|
|
|
|
return $value; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub truncstr { |
29
|
0
|
|
|
0
|
0
|
|
my ($message, $cutoff) = @_; |
30
|
0
|
0
|
|
|
|
|
return $message unless defined $cutoff; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
if (length($message) > $cutoff) { |
33
|
0
|
|
|
|
|
|
return substr($message, 0, $cutoff-3) . '...'; |
34
|
|
|
|
|
|
|
} else { |
35
|
0
|
|
|
|
|
|
return $message; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |