Filename | /usr/lib/x86_64-linux-gnu/perl/5.28/Encode/Alias.pm |
Statements | Executed 451 statements in 2.02ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 197µs | 338µs | init_aliases | Encode::Alias::
48 | 48 | 2 | 120µs | 120µs | define_alias | Encode::Alias::
49 | 45 | 1 | 27µs | 27µs | CORE:qr (opcode) | Encode::Alias::
1 | 1 | 1 | 12µs | 14µs | BEGIN@2 | Encode::Alias::
1 | 1 | 1 | 6µs | 11µs | BEGIN@7 | Encode::Alias::
1 | 1 | 1 | 5µs | 36µs | BEGIN@5 | Encode::Alias::
1 | 1 | 1 | 4µs | 18µs | BEGIN@3 | Encode::Alias::
1 | 1 | 1 | 4µs | 4µs | BEGIN@111 | Encode::Alias::
1 | 1 | 1 | 3µs | 3µs | CORE:match (opcode) | Encode::Alias::
1 | 1 | 1 | 900ns | 900ns | undef_aliases | Encode::Alias::
0 | 0 | 0 | 0s | 0s | find_alias | Encode::Alias::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Encode::Alias; | ||||
2 | 2 | 18µs | 2 | 16µs | # spent 14µs (12+2) within Encode::Alias::BEGIN@2 which was called:
# once (12µs+2µs) by Encode::BEGIN@52 at line 2 # spent 14µs making 1 call to Encode::Alias::BEGIN@2
# spent 2µs making 1 call to strict::import |
3 | 2 | 55µs | 2 | 32µs | # spent 18µs (4+14) within Encode::Alias::BEGIN@3 which was called:
# once (4µs+14µs) by Encode::BEGIN@52 at line 3 # spent 18µs making 1 call to Encode::Alias::BEGIN@3
# spent 14µs making 1 call to warnings::import |
4 | 3 | 14µs | 1 | 3µs | our $VERSION = do { my @r = ( q$Revision: 2.24 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # spent 3µs making 1 call to Encode::Alias::CORE:match |
5 | 2 | 28µs | 2 | 68µs | # spent 36µs (5+31) within Encode::Alias::BEGIN@5 which was called:
# once (5µs+31µs) by Encode::BEGIN@52 at line 5 # spent 36µs making 1 call to Encode::Alias::BEGIN@5
# spent 31µs making 1 call to constant::import |
6 | |||||
7 | 2 | 572µs | 2 | 16µs | # spent 11µs (6+5) within Encode::Alias::BEGIN@7 which was called:
# once (6µs+5µs) by Encode::BEGIN@52 at line 7 # spent 11µs making 1 call to Encode::Alias::BEGIN@7
# spent 5µs making 1 call to Exporter::import |
8 | |||||
9 | # Public, encouraged API is exported by default | ||||
10 | |||||
11 | 1 | 500ns | our @EXPORT = | ||
12 | qw ( | ||||
13 | define_alias | ||||
14 | find_alias | ||||
15 | ); | ||||
16 | |||||
17 | our @Alias; # ordered matching list | ||||
18 | our %Alias; # cached known aliases | ||||
19 | |||||
20 | sub find_alias { | ||||
21 | my $class = shift; | ||||
22 | my $find = shift; | ||||
23 | unless ( exists $Alias{$find} ) { | ||||
24 | $Alias{$find} = undef; # Recursion guard | ||||
25 | for ( my $i = 0 ; $i < @Alias ; $i += 2 ) { | ||||
26 | my $alias = $Alias[$i]; | ||||
27 | my $val = $Alias[ $i + 1 ]; | ||||
28 | my $new; | ||||
29 | if ( ref($alias) eq 'Regexp' && $find =~ $alias ) { | ||||
30 | DEBUG and warn "eval $val"; | ||||
31 | $new = eval $val; | ||||
32 | DEBUG and $@ and warn "$val, $@"; | ||||
33 | } | ||||
34 | elsif ( ref($alias) eq 'CODE' ) { | ||||
35 | DEBUG and warn "$alias", "->", "($find)"; | ||||
36 | $new = $alias->($find); | ||||
37 | } | ||||
38 | elsif ( lc($find) eq lc($alias) ) { | ||||
39 | $new = $val; | ||||
40 | } | ||||
41 | if ( defined($new) ) { | ||||
42 | next if $new eq $find; # avoid (direct) recursion on bugs | ||||
43 | DEBUG and warn "$alias, $new"; | ||||
44 | my $enc = | ||||
45 | ( ref($new) ) ? $new : Encode::find_encoding($new); | ||||
46 | if ($enc) { | ||||
47 | $Alias{$find} = $enc; | ||||
48 | last; | ||||
49 | } | ||||
50 | } | ||||
51 | } | ||||
52 | |||||
53 | # case insensitive search when canonical is not in all lowercase | ||||
54 | # RT ticket #7835 | ||||
55 | unless ( $Alias{$find} ) { | ||||
56 | my $lcfind = lc($find); | ||||
57 | for my $name ( keys %Encode::Encoding, keys %Encode::ExtModule ) | ||||
58 | { | ||||
59 | $lcfind eq lc($name) or next; | ||||
60 | $Alias{$find} = Encode::find_encoding($name); | ||||
61 | DEBUG and warn "$find => $name"; | ||||
62 | } | ||||
63 | } | ||||
64 | } | ||||
65 | if (DEBUG) { | ||||
66 | my $name; | ||||
67 | if ( my $e = $Alias{$find} ) { | ||||
68 | $name = $e->name; | ||||
69 | } | ||||
70 | else { | ||||
71 | $name = ""; | ||||
72 | } | ||||
73 | warn "find_alias($class, $find)->name = $name"; | ||||
74 | } | ||||
75 | return $Alias{$find}; | ||||
76 | } | ||||
77 | |||||
78 | # spent 120µs within Encode::Alias::define_alias which was called 48 times, avg 2µs/call:
# once (8µs+0s) by Encode::Alias::init_aliases at line 192
# once (7µs+0s) by Encode::define_encoding at line 147 of Encode.pm
# once (5µs+0s) by Encode::Alias::init_aliases at line 146
# once (4µs+0s) by Encode::Alias::init_aliases at line 141
# once (4µs+0s) by Encode::Alias::init_aliases at line 151
# once (4µs+0s) by Encode::Alias::init_aliases at line 215
# once (4µs+0s) by Encode::Alias::init_aliases at line 249
# once (3µs+0s) by Encode::Alias::init_aliases at line 144
# once (3µs+0s) by Encode::Alias::init_aliases at line 145
# once (2µs+0s) by Encode::Alias::init_aliases at line 159
# once (2µs+0s) by Encode::Alias::init_aliases at line 160
# once (2µs+0s) by Encode::Alias::init_aliases at line 229
# once (2µs+0s) by Encode::Alias::init_aliases at line 267
# once (2µs+0s) by Encode::Alias::init_aliases at line 244
# once (2µs+0s) by Encode::Alias::init_aliases at line 201
# once (2µs+0s) by Encode::Alias::init_aliases at line 230
# once (2µs+0s) by Encode::Alias::init_aliases at line 261
# once (2µs+0s) by Encode::Alias::init_aliases at line 241
# once (2µs+0s) by Encode::Alias::init_aliases at line 174
# once (2µs+0s) by Encode::Alias::init_aliases at line 253
# once (2µs+0s) by Encode::Alias::init_aliases at line 237
# once (2µs+0s) by Encode::Alias::init_aliases at line 163
# once (2µs+0s) by Encode::Alias::init_aliases at line 266
# once (2µs+0s) by Encode::Alias::init_aliases at line 246
# once (2µs+0s) by Encode::Alias::init_aliases at line 166
# once (2µs+0s) by Encode::Alias::init_aliases at line 273
# once (2µs+0s) by Encode::Alias::init_aliases at line 234
# once (2µs+0s) by Encode::Alias::init_aliases at line 206
# once (2µs+0s) by Encode::Alias::init_aliases at line 254
# once (2µs+0s) by Encode::Alias::init_aliases at line 185
# once (2µs+0s) by Encode::Alias::init_aliases at line 219
# once (2µs+0s) by Encode::Alias::init_aliases at line 245
# once (2µs+0s) by Encode::Alias::init_aliases at line 258
# once (2µs+0s) by Encode::Alias::init_aliases at line 270
# once (2µs+0s) by Encode::Alias::init_aliases at line 217
# once (2µs+0s) by Encode::Alias::init_aliases at line 259
# once (2µs+0s) by Encode::Alias::init_aliases at line 169
# once (2µs+0s) by Encode::Alias::init_aliases at line 179
# once (2µs+0s) by Encode::Alias::init_aliases at line 158
# once (2µs+0s) by Encode::Alias::init_aliases at line 243
# once (2µs+0s) by Encode::Alias::init_aliases at line 181
# once (2µs+0s) by Encode::Alias::init_aliases at line 250
# once (2µs+0s) by Encode::Alias::init_aliases at line 260
# once (2µs+0s) by Encode::Alias::init_aliases at line 224
# once (2µs+0s) by Encode::Alias::init_aliases at line 242
# once (2µs+0s) by Encode::Alias::init_aliases at line 262
# once (2µs+0s) by Encode::Alias::init_aliases at line 255
# once (2µs+0s) by Encode::Alias::init_aliases at line 240 | ||||
79 | 48 | 90µs | while (@_) { | ||
80 | 57 | 8µs | my $alias = shift; | ||
81 | 57 | 9µs | my $name = shift; | ||
82 | 57 | 23µs | unshift( @Alias, $alias => $name ) # newer one has precedence | ||
83 | if defined $alias; | ||||
84 | 57 | 24µs | if ( ref($alias) ) { | ||
85 | |||||
86 | # clear %Alias cache to allow overrides | ||||
87 | 49 | 9µs | my @a = keys %Alias; | ||
88 | 49 | 13µs | for my $k (@a) { | ||
89 | if ( ref($alias) eq 'Regexp' && $k =~ $alias ) { | ||||
90 | DEBUG and warn "delete \$Alias\{$k\}"; | ||||
91 | delete $Alias{$k}; | ||||
92 | } | ||||
93 | elsif ( ref($alias) eq 'CODE' && $alias->($k) ) { | ||||
94 | DEBUG and warn "delete \$Alias\{$k\}"; | ||||
95 | delete $Alias{$k}; | ||||
96 | } | ||||
97 | } | ||||
98 | } | ||||
99 | elsif (defined $alias) { | ||||
100 | DEBUG and warn "delete \$Alias\{$alias\}"; | ||||
101 | 8 | 2µs | delete $Alias{$alias}; | ||
102 | } | ||||
103 | elsif (DEBUG) { | ||||
104 | require Carp; | ||||
105 | Carp::croak("undef \$alias"); | ||||
106 | } | ||||
107 | } | ||||
108 | } | ||||
109 | |||||
110 | # HACK: Encode must be used after define_alias is declarated as Encode calls define_alias | ||||
111 | 2 | 967µs | 1 | 4µs | # spent 4µs within Encode::Alias::BEGIN@111 which was called:
# once (4µs+0s) by Encode::BEGIN@52 at line 111 # spent 4µs making 1 call to Encode::Alias::BEGIN@111 |
112 | |||||
113 | # Allow latin-1 style names as well | ||||
114 | # 0 1 2 3 4 5 6 7 8 9 10 | ||||
115 | 1 | 600ns | our @Latin2iso = ( 0, 1, 2, 3, 4, 9, 10, 13, 14, 15, 16 ); | ||
116 | |||||
117 | # Allow winlatin1 style names as well | ||||
118 | 1 | 4µs | our %Winlatin2cp = ( | ||
119 | 'latin1' => 1252, | ||||
120 | 'latin2' => 1250, | ||||
121 | 'cyrillic' => 1251, | ||||
122 | 'greek' => 1253, | ||||
123 | 'turkish' => 1254, | ||||
124 | 'hebrew' => 1255, | ||||
125 | 'arabic' => 1256, | ||||
126 | 'baltic' => 1257, | ||||
127 | 'vietnamese' => 1258, | ||||
128 | ); | ||||
129 | |||||
130 | 1 | 1µs | 1 | 338µs | init_aliases(); # spent 338µs making 1 call to Encode::Alias::init_aliases |
131 | |||||
132 | # spent 900ns within Encode::Alias::undef_aliases which was called:
# once (900ns+0s) by Encode::Alias::init_aliases at line 138 | ||||
133 | 1 | 300ns | @Alias = (); | ||
134 | 1 | 3µs | %Alias = (); | ||
135 | } | ||||
136 | |||||
137 | # spent 338µs (197+141) within Encode::Alias::init_aliases which was called:
# once (197µs+141µs) by Encode::BEGIN@52 at line 130 | ||||
138 | 1 | 500ns | 1 | 900ns | undef_aliases(); # spent 900ns making 1 call to Encode::Alias::undef_aliases |
139 | |||||
140 | # Try all-lower-case version should all else fails | ||||
141 | 1 | 5µs | 2 | 5µs | define_alias( qr/^(.*)$/ => '"\L$1"' ); # spent 4µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
142 | |||||
143 | # UTF/UCS stuff | ||||
144 | 1 | 3µs | 2 | 4µs | define_alias( qr/^(unicode-1-1-)?UTF-?7$/i => '"UTF-7"' ); # spent 3µs making 1 call to Encode::Alias::define_alias
# spent 600ns making 1 call to Encode::Alias::CORE:qr |
145 | 1 | 4µs | 2 | 4µs | define_alias( qr/^UCS-?2-?LE$/i => '"UCS-2LE"' ); # spent 3µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
146 | 1 | 6µs | 4 | 7µs | define_alias( # spent 5µs making 1 call to Encode::Alias::define_alias
# spent 2µs making 3 calls to Encode::Alias::CORE:qr, avg 533ns/call |
147 | qr/^UCS-?2-?(BE)?$/i => '"UCS-2BE"', | ||||
148 | qr/^UCS-?4-?(BE|LE|)?$/i => 'uc("UTF-32$1")', | ||||
149 | qr/^iso-10646-1$/i => '"UCS-2BE"' | ||||
150 | ); | ||||
151 | 1 | 5µs | 4 | 6µs | define_alias( # spent 4µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 3 calls to Encode::Alias::CORE:qr, avg 433ns/call |
152 | qr/^UTF-?(16|32)-?BE$/i => '"UTF-$1BE"', | ||||
153 | qr/^UTF-?(16|32)-?LE$/i => '"UTF-$1LE"', | ||||
154 | qr/^UTF-?(16|32)$/i => '"UTF-$1"', | ||||
155 | ); | ||||
156 | |||||
157 | # ASCII | ||||
158 | 1 | 3µs | 2 | 2µs | define_alias( qr/^(?:US-?)ascii$/i => '"ascii"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
159 | 1 | 600ns | 1 | 2µs | define_alias( 'C' => 'ascii' ); # spent 2µs making 1 call to Encode::Alias::define_alias |
160 | 1 | 2µs | 2 | 3µs | define_alias( qr/\b(?:ISO[-_]?)?646(?:[-_]?US)?$/i => '"ascii"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
161 | |||||
162 | # Allow variants of iso-8859-1 etc. | ||||
163 | 1 | 3µs | 2 | 3µs | define_alias( qr/\biso[-_]?(\d+)[-_](\d+)$/i => '"iso-$1-$2"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 600ns making 1 call to Encode::Alias::CORE:qr |
164 | |||||
165 | # At least HP-UX has these. | ||||
166 | 1 | 5µs | 2 | 2µs | define_alias( qr/\biso8859(\d+)$/i => '"iso-8859-$1"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to Encode::Alias::CORE:qr |
167 | |||||
168 | # More HP stuff. | ||||
169 | 1 | 3µs | 2 | 2µs | define_alias( # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
170 | qr/\b(?:hp-)?(arabic|greek|hebrew|kana|roman|thai|turkish)8$/i => | ||||
171 | '"${1}8"' ); | ||||
172 | |||||
173 | # The Official name of ASCII. | ||||
174 | 1 | 3µs | 2 | 3µs | define_alias( qr/\bANSI[-_]?X3\.4[-_]?1968$/i => '"ascii"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
175 | |||||
176 | # This is a font issue, not an encoding issue. | ||||
177 | # (The currency symbol of the Latin 1 upper half | ||||
178 | # has been redefined as the euro symbol.) | ||||
179 | 1 | 2µs | 2 | 2µs | define_alias( qr/^(.+)\@euro$/i => '"$1"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to Encode::Alias::CORE:qr |
180 | |||||
181 | 1 | 3µs | 2 | 2µs | define_alias( qr/\b(?:iso[-_]?)?latin[-_]?(\d+)$/i => # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
182 | 'defined $Encode::Alias::Latin2iso[$1] ? "iso-8859-$Encode::Alias::Latin2iso[$1]" : undef' | ||||
183 | ); | ||||
184 | |||||
185 | 1 | 2µs | 2 | 2µs | define_alias( # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
186 | qr/\bwin(latin[12]|cyrillic|baltic|greek|turkish| | ||||
187 | hebrew|arabic|baltic|vietnamese)$/ix => | ||||
188 | '"cp" . $Encode::Alias::Winlatin2cp{lc($1)}' | ||||
189 | ); | ||||
190 | |||||
191 | # Common names for non-latin preferred MIME names | ||||
192 | 1 | 800ns | 1 | 8µs | define_alias( # spent 8µs making 1 call to Encode::Alias::define_alias |
193 | 'ascii' => 'US-ascii', | ||||
194 | 'cyrillic' => 'iso-8859-5', | ||||
195 | 'arabic' => 'iso-8859-6', | ||||
196 | 'greek' => 'iso-8859-7', | ||||
197 | 'hebrew' => 'iso-8859-8', | ||||
198 | 'thai' => 'iso-8859-11', | ||||
199 | ); | ||||
200 | # RT #20781 | ||||
201 | 1 | 3µs | 2 | 3µs | define_alias(qr/\btis-?620\b/i => '"iso-8859-11"'); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
202 | |||||
203 | # At least AIX has IBM-NNN (surprisingly...) instead of cpNNN. | ||||
204 | # And Microsoft has their own naming (again, surprisingly). | ||||
205 | # And windows-* is registered in IANA! | ||||
206 | 1 | 2µs | 2 | 3µs | define_alias( # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 700ns making 1 call to Encode::Alias::CORE:qr |
207 | qr/\b(?:cp|ibm|ms|windows)[-_ ]?(\d{2,4})$/i => '"cp$1"' ); | ||||
208 | |||||
209 | # Sometimes seen with a leading zero. | ||||
210 | # define_alias( qr/\bcp037\b/i => '"cp37"'); | ||||
211 | |||||
212 | # Mac Mappings | ||||
213 | # predefined in *.ucm; unneeded | ||||
214 | # define_alias( qr/\bmacIcelandic$/i => '"macIceland"'); | ||||
215 | 1 | 14µs | 2 | 5µs | define_alias( qr/^(?:x[_-])?mac[_-](.*)$/i => '"mac$1"' ); # spent 4µs making 1 call to Encode::Alias::define_alias
# spent 600ns making 1 call to Encode::Alias::CORE:qr |
216 | # http://rt.cpan.org/Ticket/Display.html?id=36326 | ||||
217 | 1 | 2µs | 2 | 2µs | define_alias( qr/^macintosh$/i => '"MacRoman"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 600ns making 1 call to Encode::Alias::CORE:qr |
218 | # https://rt.cpan.org/Ticket/Display.html?id=78125 | ||||
219 | 1 | 3µs | 2 | 3µs | define_alias( qr/^macce$/i => '"MacCentralEurRoman"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 800ns making 1 call to Encode::Alias::CORE:qr |
220 | # Ououououou. gone. They are different! | ||||
221 | # define_alias( qr/\bmacRomanian$/i => '"macRumanian"'); | ||||
222 | |||||
223 | # Standardize on the dashed versions. | ||||
224 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bkoi8[\s\-_]*([ru])$/i => '"koi8-$1"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
225 | |||||
226 | 1 | 400ns | unless ($Encode::ON_EBCDIC) { | ||
227 | |||||
228 | # for Encode::CN | ||||
229 | 1 | 6µs | 2 | 3µs | define_alias( qr/\beuc.*cn$/i => '"euc-cn"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
230 | 1 | 3µs | 2 | 3µs | define_alias( qr/\bcn.*euc$/i => '"euc-cn"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 700ns making 1 call to Encode::Alias::CORE:qr |
231 | |||||
232 | # define_alias( qr/\bGB[- ]?(\d+)$/i => '"euc-cn"' ) | ||||
233 | # CP936 doesn't have vendor-addon for GBK, so they're identical. | ||||
234 | 1 | 2µs | 2 | 2µs | define_alias( qr/^gbk$/i => '"cp936"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
235 | |||||
236 | # This fixes gb2312 vs. euc-cn confusion, practically | ||||
237 | 1 | 3µs | 2 | 3µs | define_alias( qr/\bGB[-_ ]?2312(?!-?raw)/i => '"euc-cn"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
238 | |||||
239 | # for Encode::JP | ||||
240 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bjis$/i => '"7bit-jis"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
241 | 1 | 4µs | 2 | 3µs | define_alias( qr/\beuc.*jp$/i => '"euc-jp"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
242 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bjp.*euc$/i => '"euc-jp"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
243 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bujis$/i => '"euc-jp"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
244 | 1 | 2µs | 2 | 3µs | define_alias( qr/\bshift.*jis$/i => '"shiftjis"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
245 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bsjis$/i => '"shiftjis"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
246 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bwindows-31j$/i => '"cp932"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
247 | |||||
248 | # for Encode::KR | ||||
249 | 1 | 15µs | 2 | 5µs | define_alias( qr/\beuc.*kr$/i => '"euc-kr"' ); # spent 4µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
250 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bkr.*euc$/i => '"euc-kr"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
251 | |||||
252 | # This fixes ksc5601 vs. euc-kr confusion, practically | ||||
253 | 1 | 3µs | 2 | 3µs | define_alias( qr/(?:x-)?uhc$/i => '"cp949"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
254 | 1 | 3µs | 2 | 3µs | define_alias( qr/(?:x-)?windows-949$/i => '"cp949"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 1µs making 1 call to Encode::Alias::CORE:qr |
255 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bks_c_5601-1987$/i => '"cp949"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
256 | |||||
257 | # for Encode::TW | ||||
258 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bbig-?5$/i => '"big5-eten"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to Encode::Alias::CORE:qr |
259 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bbig5-?et(?:en)?$/i => '"big5-eten"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
260 | 1 | 3µs | 2 | 3µs | define_alias( qr/\btca[-_]?big5$/i => '"big5-eten"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 800ns making 1 call to Encode::Alias::CORE:qr |
261 | 1 | 2µs | 2 | 3µs | define_alias( qr/\bbig5-?hk(?:scs)?$/i => '"big5-hkscs"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
262 | 1 | 4µs | 2 | 2µs | define_alias( qr/\bhk(?:scs)?[-_]?big5$/i => '"big5-hkscs"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
263 | } | ||||
264 | |||||
265 | # https://github.com/dankogai/p5-encode/issues/37 | ||||
266 | 1 | 4µs | 2 | 2µs | define_alias(qr/cp65000/i => '"UTF-7"'); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
267 | 1 | 3µs | 2 | 3µs | define_alias(qr/cp65001/i => '"utf-8-strict"'); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to Encode::Alias::CORE:qr |
268 | |||||
269 | # utf8 is blessed :) | ||||
270 | 1 | 3µs | 2 | 2µs | define_alias( qr/\bUTF-8$/i => '"utf-8-strict"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 600ns making 1 call to Encode::Alias::CORE:qr |
271 | |||||
272 | # At last, Map white space and _ to '-' | ||||
273 | 1 | 5µs | 2 | 3µs | define_alias( qr/^([^\s_]+)[\s_]+([^\s_]*)$/i => '"$1-$2"' ); # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 600ns making 1 call to Encode::Alias::CORE:qr |
274 | } | ||||
275 | |||||
276 | 1 | 10µs | 1; | ||
277 | __END__ | ||||
# spent 3µs within Encode::Alias::CORE:match which was called:
# once (3µs+0s) by Encode::BEGIN@52 at line 4 | |||||
# spent 27µs within Encode::Alias::CORE:qr which was called 49 times, avg 555ns/call:
# 3 times (2µs+0s) by Encode::Alias::init_aliases at line 146, avg 533ns/call
# 3 times (1µs+0s) by Encode::Alias::init_aliases at line 151, avg 433ns/call
# once (1µs+0s) by Encode::Alias::init_aliases at line 141
# once (1µs+0s) by Encode::Alias::init_aliases at line 254
# once (1µs+0s) by Encode::Alias::init_aliases at line 145
# once (800ns+0s) by Encode::Alias::init_aliases at line 260
# once (800ns+0s) by Encode::Alias::init_aliases at line 219
# once (700ns+0s) by Encode::Alias::init_aliases at line 206
# once (700ns+0s) by Encode::Alias::init_aliases at line 230
# once (600ns+0s) by Encode::Alias::init_aliases at line 270
# once (600ns+0s) by Encode::Alias::init_aliases at line 273
# once (600ns+0s) by Encode::Alias::init_aliases at line 217
# once (600ns+0s) by Encode::Alias::init_aliases at line 144
# once (600ns+0s) by Encode::Alias::init_aliases at line 163
# once (600ns+0s) by Encode::Alias::init_aliases at line 215
# once (500ns+0s) by Encode::Alias::init_aliases at line 174
# once (500ns+0s) by Encode::Alias::init_aliases at line 234
# once (500ns+0s) by Encode::Alias::init_aliases at line 158
# once (500ns+0s) by Encode::Alias::init_aliases at line 249
# once (500ns+0s) by Encode::Alias::init_aliases at line 240
# once (500ns+0s) by Encode::Alias::init_aliases at line 243
# once (500ns+0s) by Encode::Alias::init_aliases at line 255
# once (500ns+0s) by Encode::Alias::init_aliases at line 266
# once (500ns+0s) by Encode::Alias::init_aliases at line 181
# once (500ns+0s) by Encode::Alias::init_aliases at line 237
# once (500ns+0s) by Encode::Alias::init_aliases at line 224
# once (500ns+0s) by Encode::Alias::init_aliases at line 250
# once (500ns+0s) by Encode::Alias::init_aliases at line 253
# once (500ns+0s) by Encode::Alias::init_aliases at line 259
# once (500ns+0s) by Encode::Alias::init_aliases at line 246
# once (500ns+0s) by Encode::Alias::init_aliases at line 245
# once (500ns+0s) by Encode::Alias::init_aliases at line 242
# once (500ns+0s) by Encode::Alias::init_aliases at line 229
# once (500ns+0s) by Encode::Alias::init_aliases at line 185
# once (500ns+0s) by Encode::Alias::init_aliases at line 261
# once (500ns+0s) by Encode::Alias::init_aliases at line 160
# once (500ns+0s) by Encode::Alias::init_aliases at line 169
# once (500ns+0s) by Encode::Alias::init_aliases at line 201
# once (500ns+0s) by Encode::Alias::init_aliases at line 262
# once (500ns+0s) by Encode::Alias::init_aliases at line 241
# once (500ns+0s) by Encode::Alias::init_aliases at line 244
# once (500ns+0s) by Encode::Alias::init_aliases at line 267
# once (400ns+0s) by Encode::Alias::init_aliases at line 179
# once (400ns+0s) by Encode::Alias::init_aliases at line 258
# once (400ns+0s) by Encode::Alias::init_aliases at line 166 |