line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Unicode::Debug; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
51174
|
use 5.008001; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
128
|
|
4
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
154
|
|
5
|
3
|
|
|
3
|
|
22
|
use warnings; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
95
|
|
6
|
3
|
|
|
3
|
|
254446
|
use charnames ':full'; |
|
3
|
|
|
|
|
125026
|
|
|
3
|
|
|
|
|
20
|
|
7
|
3
|
|
|
3
|
|
659
|
use utf8; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
24
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
BEGIN |
10
|
|
|
|
|
|
|
{ |
11
|
3
|
|
|
3
|
|
196
|
$Unicode::Debug::AUTHORITY = 'cpan:TOBYINK'; |
12
|
3
|
|
|
|
|
48
|
$Unicode::Debug::VERSION = '0.002'; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
16
|
use Exporter (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1964
|
|
16
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
17
|
|
|
|
|
|
|
our @EXPORT = qw( unidebug ); |
18
|
|
|
|
|
|
|
our @EXPORT_OK = ( @EXPORT, qw(unidecode) ); |
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
20
|
|
|
|
|
|
|
default => \@EXPORT, |
21
|
|
|
|
|
|
|
standard => \@EXPORT, |
22
|
|
|
|
|
|
|
all => \@EXPORT_OK, |
23
|
|
|
|
|
|
|
nothing => [], |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $Whitespace = 0; |
27
|
|
|
|
|
|
|
our $Names = 0; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub unidecode |
30
|
|
|
|
|
|
|
{ |
31
|
4
|
100
|
|
4
|
1
|
24
|
unless (defined wantarray) |
32
|
|
|
|
|
|
|
{ |
33
|
1
|
|
|
|
|
8
|
s/(\r\n|[^\x20-\x7F])/_char($1)/eg for @_; |
|
2
|
|
|
|
|
5
|
|
34
|
1
|
|
|
|
|
2
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
|
|
|
25
|
my @str = map { |
38
|
3
|
50
|
|
|
|
13
|
(my $str = $_) =~ s/(\r\n|\\|[^\x20-\x7F])/_char($1)/eg; |
|
6
|
|
|
|
|
20
|
|
39
|
3
|
|
|
|
|
44
|
$str; |
40
|
|
|
|
|
|
|
} (wantarray ? @_ : $_[0]); |
41
|
|
|
|
|
|
|
|
42
|
3
|
50
|
|
|
|
26
|
wantarray ? @str : $str[0]; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my %wschars = ( |
46
|
|
|
|
|
|
|
"\r\n" => "\\r\\n\n", |
47
|
|
|
|
|
|
|
"\r" => "\\r\n", |
48
|
|
|
|
|
|
|
"\n" => "\\n\n", |
49
|
|
|
|
|
|
|
"\t" => "\\t", |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _char |
53
|
|
|
|
|
|
|
{ |
54
|
8
|
50
|
|
8
|
|
47
|
return $Whitespace ? $wschars{$_[0]} : $_[0] |
|
|
100
|
|
|
|
|
|
55
|
|
|
|
|
|
|
if exists $wschars{$_[0]}; |
56
|
|
|
|
|
|
|
|
57
|
6
|
|
|
|
|
16
|
my $chr = shift; |
58
|
6
|
|
|
|
|
9
|
my $ord = ord $chr; |
59
|
|
|
|
|
|
|
|
60
|
6
|
50
|
|
|
|
39
|
return "\\\\" if $chr eq "\\"; |
61
|
|
|
|
|
|
|
|
62
|
6
|
100
|
66
|
|
|
31
|
if ($Names and my $name = charnames::viacode($ord)) |
63
|
|
|
|
|
|
|
{ |
64
|
2
|
|
|
|
|
16756
|
return sprintf('\N{%s}', $name); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
31
|
sprintf('\x{%04x}', $ord); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
*unidebug = \&unidecode; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
require PerlIO::via::UnicodeDebug; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__PACKAGE__ |
75
|
|
|
|
|
|
|
__END__ |