line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package String::Dump; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
51828
|
use 5.006; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
78
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
64
|
|
6
|
2
|
|
|
2
|
|
1860
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
743
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
1907
|
use charnames qw( :full ); |
|
2
|
|
|
|
|
85292
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
737
|
use Carp; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1326
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
11
|
|
|
|
|
|
|
our @EXPORT = qw( dump_hex dump_dec dump_oct dump_bin dump_names dump_codes ); |
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => \@EXPORT); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dump_hex { |
15
|
4
|
|
|
4
|
1
|
2088
|
my ($str) = @_; |
16
|
4
|
100
|
50
|
|
|
46
|
carp('dump_hex() expects one argument') && return if @_ != 1; |
17
|
2
|
50
|
|
|
|
8
|
return unless defined $str; |
18
|
2
|
|
|
|
|
24
|
return sprintf '%*vX', ' ', $str; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub dump_dec { |
22
|
4
|
|
|
4
|
1
|
1678
|
my ($str) = @_; |
23
|
4
|
100
|
50
|
|
|
33
|
carp('dump_dec() expects one argument') && return if @_ != 1; |
24
|
2
|
50
|
|
|
|
6
|
return unless defined $str; |
25
|
2
|
|
|
|
|
19
|
return sprintf '%*vd', ' ', $str; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub dump_oct { |
29
|
4
|
|
|
4
|
1
|
1702
|
my ($str) = @_; |
30
|
4
|
100
|
50
|
|
|
28
|
carp('dump_oct() expects one argument') && return if @_ != 1; |
31
|
2
|
50
|
|
|
|
6
|
return unless defined $str; |
32
|
2
|
|
|
|
|
14
|
return sprintf '%*vo', ' ', $str; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub dump_bin { |
36
|
4
|
|
|
4
|
1
|
1771
|
my ($str) = @_; |
37
|
4
|
100
|
50
|
|
|
56
|
carp('dump_bin() expects one argument') && return if @_ != 1; |
38
|
2
|
50
|
|
|
|
7
|
return unless defined $str; |
39
|
2
|
|
|
|
|
14
|
return sprintf '%*vb', ' ', $str; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub dump_names { |
43
|
3
|
|
|
3
|
1
|
1526
|
my ($str) = @_; |
44
|
3
|
100
|
50
|
|
|
24
|
carp('dump_names() expects one argument') && return if @_ != 1; |
45
|
1
|
50
|
|
|
|
4
|
return unless defined $str; |
46
|
6
|
50
|
|
|
|
12692
|
return join ', ', |
47
|
1
|
|
|
|
|
5
|
map { charnames::viacode(ord) || '?' } |
48
|
|
|
|
|
|
|
split '', $str; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub dump_codes { |
52
|
4
|
|
|
4
|
1
|
1706
|
my ($str) = @_; |
53
|
4
|
100
|
50
|
|
|
27
|
carp('dump_codes() expects one argument') && return if @_ != 1; |
54
|
2
|
50
|
|
|
|
7
|
return unless defined $str; |
55
|
2
|
|
|
|
|
9
|
return join ' ', map { sprintf 'U+%04X', ord } split '', $str; |
|
7
|
|
|
|
|
25
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |