line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Undiacritic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
43836
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
125
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); ## no critic |
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(undiacritic); |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
492
|
use charnames ':full'; |
|
2
|
|
|
|
|
23623
|
|
|
2
|
|
|
|
|
9
|
|
12
|
2
|
|
|
2
|
|
1355
|
use Unicode::Normalize qw(decompose); |
|
2
|
|
|
|
|
3266
|
|
|
2
|
|
|
|
|
298
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub undiacritic { |
15
|
11
|
|
|
11
|
1
|
1552
|
my $characters = shift; |
16
|
|
|
|
|
|
|
|
17
|
11
|
100
|
|
|
|
24
|
if ( !$characters ) { return $characters; } |
|
3
|
|
|
|
|
10
|
|
18
|
|
|
|
|
|
|
|
19
|
8
|
|
|
|
|
52
|
$characters = decompose($characters); |
20
|
8
|
|
|
|
|
46
|
$characters =~ s/\p{NonspacingMark}//gxms; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return join('', |
23
|
|
|
|
|
|
|
map { |
24
|
8
|
|
|
|
|
23
|
(ord($_) > 127) |
25
|
12
|
100
|
|
|
|
55
|
? do { |
26
|
1
|
|
|
|
|
5
|
my $charname = charnames::viacode(ord $_); |
27
|
1
|
|
|
|
|
102
|
$charname =~ s/\s WITH \s .+ \z//x; |
28
|
|
|
|
|
|
|
#charnames::string_vianame($charname); |
29
|
1
|
|
|
|
|
4
|
chr charnames::vianame($charname); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
: $_; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
split //, $characters |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |