| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyright (c) 2018, cPanel, LLC. |
|
2
|
|
|
|
|
|
|
# All rights reserved. |
|
3
|
|
|
|
|
|
|
# http://cpanel.net |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under the |
|
6
|
|
|
|
|
|
|
# same terms as Perl itself. See L. |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Char::Replace; |
|
9
|
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
|
3010858
|
use strict; |
|
|
12
|
|
|
|
|
30
|
|
|
|
12
|
|
|
|
|
469
|
|
|
11
|
12
|
|
|
12
|
|
129
|
use warnings; |
|
|
12
|
|
|
|
|
32
|
|
|
|
12
|
|
|
|
|
1117
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Perl naive XS character replacement as an alternate to substitute or transliterate |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
BEGIN { |
|
17
|
|
|
|
|
|
|
|
|
18
|
12
|
|
|
12
|
|
51
|
our $VERSION = '0.007'; # VERSION: generated by DZP::OurPkgVersion |
|
19
|
|
|
|
|
|
|
|
|
20
|
12
|
|
|
|
|
60
|
require XSLoader; |
|
21
|
12
|
|
|
|
|
10783
|
XSLoader::load(__PACKAGE__); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub identity_map { |
|
25
|
94
|
|
|
94
|
1
|
3379563
|
my $MAP = []; |
|
26
|
94
|
|
|
|
|
17396
|
$MAP->[ $_ ] = chr($_) for 0..255; |
|
27
|
94
|
|
|
|
|
5439
|
return $MAP; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub build_map { |
|
31
|
10
|
|
|
10
|
1
|
495959
|
my (%pairs) = @_; |
|
32
|
10
|
|
|
|
|
29
|
my $MAP = identity_map(); |
|
33
|
10
|
|
|
|
|
35
|
for my $from ( keys %pairs ) { |
|
34
|
|
|
|
|
|
|
length($from) == 1 |
|
35
|
12
|
100
|
|
|
|
39
|
or do { require Carp; Carp::croak("build_map: key must be a single character, got '$from'") }; |
|
|
2
|
|
|
|
|
22
|
|
|
|
2
|
|
|
|
|
437
|
|
|
36
|
10
|
|
|
|
|
30
|
$MAP->[ ord($from) ] = $pairs{$from}; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
8
|
|
|
|
|
34
|
return $MAP; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |