| Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/x86_64-linux/Encode/Alias.pm |
| Statements | Executed 453 statements in 1.41ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 115µs | 246µs | Encode::Alias::init_aliases |
| 48 | 48 | 1 | 102µs | 102µs | Encode::Alias::define_alias |
| 1 | 1 | 1 | 9µs | 10µs | Encode::Alias::BEGIN@2 |
| 1 | 1 | 1 | 4µs | 27µs | Encode::Alias::BEGIN@5 |
| 1 | 1 | 1 | 4µs | 7µs | Encode::Alias::BEGIN@7 |
| 1 | 1 | 1 | 3µs | 18µs | Encode::Alias::BEGIN@3 |
| 1 | 1 | 1 | 3µs | 3µs | Encode::Alias::BEGIN@111 |
| 1 | 1 | 1 | 600ns | 600ns | Encode::Alias::undef_aliases |
| 0 | 0 | 0 | 0s | 0s | Encode::Alias::find_alias |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Encode::Alias; | ||||
| 2 | 2 | 17µs | 2 | 12µs | # spent 10µs (9+1) within Encode::Alias::BEGIN@2 which was called:
# once (9µs+1µs) by Encode::BEGIN@53 at line 2 # spent 10µs making 1 call to Encode::Alias::BEGIN@2
# spent 2µs making 1 call to strict::import |
| 3 | 2 | 50µs | 2 | 34µs | # spent 18µs (3+16) within Encode::Alias::BEGIN@3 which was called:
# once (3µs+16µs) by Encode::BEGIN@53 at line 3 # spent 18µs making 1 call to Encode::Alias::BEGIN@3
# spent 16µs making 1 call to warnings::import |
| 4 | 3 | 10µs | 1 | 3µs | our $VERSION = do { my @r = ( q$Revision: 2.25 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # spent 3µs making 1 call to CORE::match |
| 5 | 2 | 17µs | 2 | 49µs | # spent 27µs (4+22) within Encode::Alias::BEGIN@5 which was called:
# once (4µs+22µs) by Encode::BEGIN@53 at line 5 # spent 27µs making 1 call to Encode::Alias::BEGIN@5
# spent 22µs making 1 call to constant::import |
| 6 | |||||
| 7 | 2 | 352µs | 2 | 10µs | # spent 7µs (4+4) within Encode::Alias::BEGIN@7 which was called:
# once (4µs+4µs) by Encode::BEGIN@53 at line 7 # spent 7µs making 1 call to Encode::Alias::BEGIN@7
# spent 4µ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 102µs within Encode::Alias::define_alias which was called 48 times, avg 2µs/call:
# once (34µs+0s) by Encode::Alias::init_aliases at line 196
# once (4µs+0s) by Encode::Alias::init_aliases at line 205
# once (3µs+0s) by Encode::Alias::init_aliases at line 141
# once (3µs+0s) by Encode::Alias::init_aliases at line 146
# once (3µs+0s) by Encode::Alias::init_aliases at line 145
# once (3µs+0s) by Encode::Alias::init_aliases at line 151
# once (3µs+0s) by Encode::Alias::init_aliases at line 253
# once (2µs+0s) by Encode::Alias::init_aliases at line 250
# once (2µs+0s) by Encode::Alias::init_aliases at line 159
# once (2µs+0s) by Encode::Alias::init_aliases at line 189
# once (2µs+0s) by Encode::Alias::init_aliases at line 259
# once (1µs+0s) by Encode::Alias::init_aliases at line 144
# once (1µs+0s) by Encode::Alias::init_aliases at line 266
# once (1µs+0s) by Encode::Alias::init_aliases at line 178
# once (1µs+0s) by Encode::Alias::init_aliases at line 163
# once (1µs+0s) by Encode::Alias::init_aliases at line 249
# once (1µs+0s) by Encode::Alias::init_aliases at line 245
# once (1µs+0s) by Encode::Alias::init_aliases at line 173
# once (1µs+0s) by Encode::Alias::init_aliases at line 262
# once (1µs+0s) by Encode::Alias::init_aliases at line 219
# once (1µs+0s) by Encode::Alias::init_aliases at line 234
# once (1µs+0s) by Encode::Alias::init_aliases at line 167
# once (1µs+0s) by Encode::Alias::init_aliases at line 221
# once (1µs+0s) by Encode::Alias::init_aliases at line 160
# once (1µs+0s) by Encode::Alias::init_aliases at line 258
# once (1µs+0s) by Encode::Alias::init_aliases at line 257
# once (1µs+0s) by Encode::Alias::init_aliases at line 241
# once (1µs+0s) by Encode::Alias::init_aliases at line 271
# once (1µs+0s) by Encode::Alias::init_aliases at line 246
# once (1µs+0s) by Encode::Alias::init_aliases at line 244
# once (1µs+0s) by Encode::Alias::init_aliases at line 228
# once (1µs+0s) by Encode::Alias::init_aliases at line 183
# once (1µs+0s) by Encode::Alias::init_aliases at line 247
# once (1µs+0s) by Encode::Alias::init_aliases at line 233
# once (1µs+0s) by Encode::Alias::init_aliases at line 248
# once (1µs+0s) by Encode::Alias::init_aliases at line 277
# once (1µs+0s) by Encode::Alias::init_aliases at line 170
# once (1µs+0s) by Encode::Alias::init_aliases at line 223
# once (1µs+0s) by Encode::Alias::init_aliases at line 274
# once (1µs+0s) by Encode::Alias::init_aliases at line 185
# once (1µs+0s) by Encode::Alias::init_aliases at line 270
# once (1µs+0s) by Encode::Alias::init_aliases at line 265
# once (1µs+0s) by Encode::Alias::init_aliases at line 238
# once (1µs+0s) by Encode::Alias::init_aliases at line 254
# once (1µs+0s) by Encode::Alias::init_aliases at line 264
# once (1µs+0s) by Encode::Alias::init_aliases at line 158
# once (1µs+0s) by Encode::Alias::init_aliases at line 210
# once (900ns+0s) by Encode::Alias::init_aliases at line 263 | ||||
| 79 | 48 | 46µs | while (@_) { | ||
| 80 | 57 | 6µs | my $alias = shift; | ||
| 81 | 57 | 6µs | my $name = shift; | ||
| 82 | 57 | 15µs | unshift( @Alias, $alias => $name ) # newer one has precedence | ||
| 83 | if defined $alias; | ||||
| 84 | 57 | 16µs | if ( ref($alias) ) { | ||
| 85 | |||||
| 86 | # clear %Alias cache to allow overrides | ||||
| 87 | 50 | 6µs | my @a = keys %Alias; | ||
| 88 | 50 | 8µ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 | 7 | 700ns | 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 | 706µs | 1 | 3µs | # spent 3µs within Encode::Alias::BEGIN@111 which was called:
# once (3µs+0s) by Encode::BEGIN@53 at line 111 # spent 3µ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 | 500ns | our @Latin2iso = ( 0, 1, 2, 3, 4, 9, 10, 13, 14, 15, 16 ); | ||
| 116 | |||||
| 117 | # Allow winlatin1 style names as well | ||||
| 118 | 1 | 2µ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 | 900ns | 1 | 246µs | init_aliases(); # spent 246µs making 1 call to Encode::Alias::init_aliases |
| 131 | |||||
| 132 | # spent 600ns within Encode::Alias::undef_aliases which was called:
# once (600ns+0s) by Encode::Alias::init_aliases at line 138 | ||||
| 133 | 1 | 200ns | @Alias = (); | ||
| 134 | 1 | 2µs | %Alias = (); | ||
| 135 | } | ||||
| 136 | |||||
| 137 | # spent 246µs (115+131) within Encode::Alias::init_aliases which was called:
# once (115µs+131µs) by Encode::BEGIN@53 at line 130 | ||||
| 138 | 1 | 400ns | 1 | 600ns | undef_aliases(); # spent 600ns making 1 call to Encode::Alias::undef_aliases |
| 139 | |||||
| 140 | # Try all-lower-case version should all else fails | ||||
| 141 | 1 | 3µs | 2 | 4µs | define_alias( qr/^(.*)$/ => '"\L$1"' ); # spent 3µs making 1 call to Encode::Alias::define_alias
# spent 900ns making 1 call to CORE::qr |
| 142 | |||||
| 143 | # UTF/UCS stuff | ||||
| 144 | 1 | 2µs | 2 | 2µs | define_alias( qr/^(unicode-1-1-)?UTF-?7$/i => '"UTF-7"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 145 | 1 | 2µ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 400ns making 1 call to CORE::qr |
| 146 | 1 | 4µs | 4 | 4µs | define_alias( # spent 3µs making 1 call to Encode::Alias::define_alias
# spent 700ns making 3 calls to CORE::qr, avg 233ns/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 | 3µs | 4 | 4µs | define_alias( # spent 3µs making 1 call to Encode::Alias::define_alias
# spent 700ns making 3 calls to CORE::qr, avg 233ns/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 | 2µs | 2 | 1µs | define_alias( qr/^(?:US-?)ascii$/i => '"ascii"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 159 | 1 | 300ns | 1 | 2µs | define_alias( 'C' => 'ascii' ); # spent 2µs making 1 call to Encode::Alias::define_alias |
| 160 | 1 | 1µs | 2 | 1µs | define_alias( qr/\b(?:ISO[-_]?)?646(?:[-_]?US)?$/i => '"ascii"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 200ns making 1 call to CORE::qr |
| 161 | |||||
| 162 | # Allow variants of iso-8859-1 etc. | ||||
| 163 | 1 | 1µs | 2 | 2µs | define_alias( qr/\biso[-_]?(\d+)[-_](\d+)$/i => '"iso-$1-$2"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 164 | |||||
| 165 | # ISO-8859-8-I => ISO-8859-8 | ||||
| 166 | # https://en.wikipedia.org/wiki/ISO-8859-8-I | ||||
| 167 | 1 | 2µs | 2 | 2µs | define_alias( qr/\biso[-_]8859[-_]8[-_]I$/i => '"iso-8859-8"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 700ns making 1 call to CORE::qr |
| 168 | |||||
| 169 | # At least HP-UX has these. | ||||
| 170 | 1 | 1µs | 2 | 1µs | define_alias( qr/\biso8859(\d+)$/i => '"iso-8859-$1"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 200ns making 1 call to CORE::qr |
| 171 | |||||
| 172 | # More HP stuff. | ||||
| 173 | 1 | 5µs | 2 | 1µs | define_alias( # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 200ns making 1 call to CORE::qr |
| 174 | qr/\b(?:hp-)?(arabic|greek|hebrew|kana|roman|thai|turkish)8$/i => | ||||
| 175 | '"${1}8"' ); | ||||
| 176 | |||||
| 177 | # The Official name of ASCII. | ||||
| 178 | 1 | 1µs | 2 | 2µs | define_alias( qr/\bANSI[-_]?X3\.4[-_]?1968$/i => '"ascii"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 179 | |||||
| 180 | # This is a font issue, not an encoding issue. | ||||
| 181 | # (The currency symbol of the Latin 1 upper half | ||||
| 182 | # has been redefined as the euro symbol.) | ||||
| 183 | 1 | 1µs | 2 | 1µs | define_alias( qr/^(.+)\@euro$/i => '"$1"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 200ns making 1 call to CORE::qr |
| 184 | |||||
| 185 | 1 | 1µs | 2 | 1µs | define_alias( qr/\b(?:iso[-_]?)?latin[-_]?(\d+)$/i => # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 186 | 'defined $Encode::Alias::Latin2iso[$1] ? "iso-8859-$Encode::Alias::Latin2iso[$1]" : undef' | ||||
| 187 | ); | ||||
| 188 | |||||
| 189 | 1 | 15µs | 2 | 2µs | define_alias( # spent 2µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 190 | qr/\bwin(latin[12]|cyrillic|baltic|greek|turkish| | ||||
| 191 | hebrew|arabic|baltic|vietnamese)$/ix => | ||||
| 192 | '"cp" . $Encode::Alias::Winlatin2cp{lc($1)}' | ||||
| 193 | ); | ||||
| 194 | |||||
| 195 | # Common names for non-latin preferred MIME names | ||||
| 196 | 1 | 28µs | 1 | 34µs | define_alias( # spent 34µs making 1 call to Encode::Alias::define_alias |
| 197 | 'ascii' => 'US-ascii', | ||||
| 198 | 'cyrillic' => 'iso-8859-5', | ||||
| 199 | 'arabic' => 'iso-8859-6', | ||||
| 200 | 'greek' => 'iso-8859-7', | ||||
| 201 | 'hebrew' => 'iso-8859-8', | ||||
| 202 | 'thai' => 'iso-8859-11', | ||||
| 203 | ); | ||||
| 204 | # RT #20781 | ||||
| 205 | 1 | 5µs | 2 | 4µs | define_alias(qr/\btis-?620\b/i => '"iso-8859-11"'); # spent 4µs making 1 call to Encode::Alias::define_alias
# spent 700ns making 1 call to CORE::qr |
| 206 | |||||
| 207 | # At least AIX has IBM-NNN (surprisingly...) instead of cpNNN. | ||||
| 208 | # And Microsoft has their own naming (again, surprisingly). | ||||
| 209 | # And windows-* is registered in IANA! | ||||
| 210 | 1 | 2µs | 2 | 1µs | define_alias( # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 211 | qr/\b(?:cp|ibm|ms|windows)[-_ ]?(\d{2,4})$/i => '"cp$1"' ); | ||||
| 212 | |||||
| 213 | # Sometimes seen with a leading zero. | ||||
| 214 | # define_alias( qr/\bcp037\b/i => '"cp37"'); | ||||
| 215 | |||||
| 216 | # Mac Mappings | ||||
| 217 | # predefined in *.ucm; unneeded | ||||
| 218 | # define_alias( qr/\bmacIcelandic$/i => '"macIceland"'); | ||||
| 219 | 1 | 1µs | 2 | 2µs | define_alias( qr/^(?:x[_-])?mac[_-](.*)$/i => '"mac$1"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 220 | # http://rt.cpan.org/Ticket/Display.html?id=36326 | ||||
| 221 | 1 | 2µs | 2 | 2µs | define_alias( qr/^macintosh$/i => '"MacRoman"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 222 | # https://rt.cpan.org/Ticket/Display.html?id=78125 | ||||
| 223 | 1 | 2µs | 2 | 1µs | define_alias( qr/^macce$/i => '"MacCentralEurRoman"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 224 | # Ououououou. gone. They are different! | ||||
| 225 | # define_alias( qr/\bmacRomanian$/i => '"macRumanian"'); | ||||
| 226 | |||||
| 227 | # Standardize on the dashed versions. | ||||
| 228 | 1 | 1µs | 2 | 2µs | define_alias( qr/\bkoi8[\s\-_]*([ru])$/i => '"koi8-$1"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 229 | |||||
| 230 | 1 | 300ns | unless ($Encode::ON_EBCDIC) { | ||
| 231 | |||||
| 232 | # for Encode::CN | ||||
| 233 | 1 | 1µs | 2 | 1µs | define_alias( qr/\beuc.*cn$/i => '"euc-cn"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 234 | 1 | 1µs | 2 | 1µs | define_alias( qr/\bcn.*euc$/i => '"euc-cn"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 200ns making 1 call to CORE::qr |
| 235 | |||||
| 236 | # define_alias( qr/\bGB[- ]?(\d+)$/i => '"euc-cn"' ) | ||||
| 237 | # CP936 doesn't have vendor-addon for GBK, so they're identical. | ||||
| 238 | 1 | 1µs | 2 | 1µs | define_alias( qr/^gbk$/i => '"cp936"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 239 | |||||
| 240 | # This fixes gb2312 vs. euc-cn confusion, practically | ||||
| 241 | 1 | 1µs | 2 | 2µs | define_alias( qr/\bGB[-_ ]?2312(?!-?raw)/i => '"euc-cn"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 242 | |||||
| 243 | # for Encode::JP | ||||
| 244 | 1 | 1µs | 2 | 2µs | define_alias( qr/\bjis$/i => '"7bit-jis"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 245 | 1 | 3µs | 2 | 4µs | define_alias( qr/\beuc.*jp$/i => '"euc-jp"' ); # spent 2µs making 1 call to CORE::qr
# spent 1µs making 1 call to Encode::Alias::define_alias |
| 246 | 1 | 5µs | 2 | 3µs | define_alias( qr/\bjp.*euc$/i => '"euc-jp"' ); # spent 2µs making 1 call to CORE::qr
# spent 1µs making 1 call to Encode::Alias::define_alias |
| 247 | 1 | 1µs | 2 | 1µs | define_alias( qr/\bujis$/i => '"euc-jp"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 248 | 1 | 1µs | 2 | 1µs | define_alias( qr/\bshift.*jis$/i => '"shiftjis"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 249 | 1 | 10µs | 2 | 10µs | define_alias( qr/\bsjis$/i => '"shiftjis"' ); # spent 9µs making 1 call to CORE::qr
# spent 1µs making 1 call to Encode::Alias::define_alias |
| 250 | 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 400ns making 1 call to CORE::qr |
| 251 | |||||
| 252 | # for Encode::KR | ||||
| 253 | 1 | 3µs | 2 | 3µs | define_alias( qr/\beuc.*kr$/i => '"euc-kr"' ); # spent 3µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 254 | 1 | 2µs | 2 | 1µs | define_alias( qr/\bkr.*euc$/i => '"euc-kr"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 255 | |||||
| 256 | # This fixes ksc5601 vs. euc-kr confusion, practically | ||||
| 257 | 1 | 1µs | 2 | 2µs | define_alias( qr/(?:x-)?uhc$/i => '"cp949"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 258 | 1 | 2µs | 2 | 2µs | define_alias( qr/(?:x-)?windows-949$/i => '"cp949"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to CORE::qr |
| 259 | 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 400ns making 1 call to CORE::qr |
| 260 | |||||
| 261 | # for Encode::TW | ||||
| 262 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bbig-?5$/i => '"big5-eten"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 263 | 1 | 1µs | 2 | 1µs | define_alias( qr/\bbig5-?et(?:en)?$/i => '"big5-eten"' ); # spent 900ns making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 264 | 1 | 1µs | 2 | 1µs | define_alias( qr/\btca[-_]?big5$/i => '"big5-eten"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 265 | 1 | 1µs | 2 | 1µs | define_alias( qr/\bbig5-?hk(?:scs)?$/i => '"big5-hkscs"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 266 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bhk(?:scs)?[-_]?big5$/i => '"big5-hkscs"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 200ns making 1 call to CORE::qr |
| 267 | } | ||||
| 268 | |||||
| 269 | # https://github.com/dankogai/p5-encode/issues/37 | ||||
| 270 | 1 | 1µs | 2 | 2µs | define_alias(qr/cp65000/i => '"UTF-7"'); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 271 | 1 | 1µs | 2 | 2µs | define_alias(qr/cp65001/i => '"utf-8-strict"'); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 300ns making 1 call to CORE::qr |
| 272 | |||||
| 273 | # utf8 is blessed :) | ||||
| 274 | 1 | 2µs | 2 | 2µs | define_alias( qr/\bUTF-8$/i => '"utf-8-strict"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 500ns making 1 call to CORE::qr |
| 275 | |||||
| 276 | # At last, Map white space and _ to '-' | ||||
| 277 | 1 | 4µs | 2 | 2µs | define_alias( qr/^([^\s_]+)[\s_]+([^\s_]*)$/i => '"$1-$2"' ); # spent 1µs making 1 call to Encode::Alias::define_alias
# spent 400ns making 1 call to CORE::qr |
| 278 | } | ||||
| 279 | |||||
| 280 | 1 | 6µs | 1; | ||
| 281 | __END__ |