line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Kantan::Util; |
2
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
85
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
61
|
|
4
|
3
|
|
|
3
|
|
14
|
use utf8; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
20
|
|
5
|
3
|
|
|
3
|
|
120
|
use 5.010_001; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
99
|
|
6
|
3
|
|
|
3
|
|
15
|
use parent qw(Exporter); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
24
|
|
7
|
3
|
|
|
3
|
|
141
|
use Data::Dumper (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
635
|
|
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; |