line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Dump::AutoEncode; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
115148
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
210
|
|
4
|
2
|
|
|
2
|
|
15
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
70
|
|
5
|
2
|
|
|
2
|
|
10
|
use Carp; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
166
|
|
6
|
2
|
|
|
2
|
|
1258
|
use Data::Dump; |
|
2
|
|
|
|
|
10248
|
|
|
2
|
|
|
|
|
237
|
|
7
|
2
|
|
|
2
|
|
12924
|
use Encode; |
|
2
|
|
|
|
|
36054
|
|
|
2
|
|
|
|
|
197
|
|
8
|
2
|
|
|
2
|
|
1755
|
use Term::Encoding; |
|
2
|
|
|
|
|
1365
|
|
|
2
|
|
|
|
|
107
|
|
9
|
2
|
|
|
2
|
|
2126
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
703
|
|
|
2
|
|
|
|
|
13
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
12
|
|
|
|
|
|
|
our @EXPORT = qw/edump/; |
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw/dump/; |
14
|
|
|
|
|
|
|
our $ENCODER; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub set_encoding { |
17
|
1
|
|
|
1
|
1
|
8
|
my $encoding = shift; |
18
|
|
|
|
|
|
|
|
19
|
1
|
50
|
33
|
|
|
7
|
$encoding ||= eval { Term::Encoding::get_encoding() } or croak "Can't find encoding: $@"; |
|
0
|
|
|
|
|
0
|
|
20
|
1
|
50
|
|
|
|
6
|
$ENCODER = find_encoding($encoding) or croak "Can't find encoding: $encoding"; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub edump { |
24
|
2
|
50
|
|
2
|
1
|
1201
|
set_encoding() unless $ENCODER; |
25
|
|
|
|
|
|
|
local @Data::Dump::FILTERS = sub { |
26
|
8
|
|
|
8
|
|
1918
|
my ($ctx, $ref) = @_; |
27
|
8
|
100
|
66
|
|
|
18
|
if ($ctx->is_scalar && !$ctx->is_blessed) { |
28
|
4
|
50
|
|
|
|
64
|
if (Encode::is_utf8($$ref)) { |
29
|
4
|
|
|
|
|
35
|
return { dump => $ENCODER->encode($$ref) }; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
2
|
|
|
|
|
12
|
}; |
33
|
2
|
|
|
|
|
6
|
return &Data::Dump::dump; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
*dump = \&edump; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |