| Filename | C:/tmp64ng/perl/lib/Encode.pm | 
| Statements | Executed 627 statements in 15.6ms | 
| Calls | P | F | Exclusive Time  | 
        Inclusive Time  | 
        Subroutine | 
|---|---|---|---|---|---|
| 1 | 1 | 1 | 15.6ms | 15.6ms | Encode::utf8::BEGIN@349 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@12 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@266 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@47 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@5 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@6 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@8 | 
| 1 | 1 | 1 | 0s | 0s | Encode::BEGIN@9 | 
| 1 | 1 | 1 | 0s | 0s | Encode::CORE:match (opcode) | 
| 9 | 2 | 1 | 0s | 0s | Encode::CORE:subst (opcode) | 
| 0 | 0 | 0 | 0s | 0s | Encode::Internal::__ANON__[:309] | 
| 1 | 1 | 1 | 0s | 0s | Encode::LEAVE_SRC (xsub) | 
| 3 | 3 | 3 | 0s | 0s | Encode::PERLQQ (xsub) | 
| 1 | 1 | 1 | 0s | 0s | Encode::STOP_AT_PARTIAL (xsub) | 
| 0 | 0 | 0 | 0s | 0s | Encode::UTF_EBCDIC::__ANON__[:284] | 
| 0 | 0 | 0 | 0s | 0s | Encode::UTF_EBCDIC::__ANON__[:296] | 
| 1 | 1 | 1 | 0s | 0s | Encode::WARN_ON_ERR (xsub) | 
| 0 | 0 | 0 | 0s | 0s | Encode::__ANON__[:165] | 
| 0 | 0 | 0 | 0s | 0s | Encode::__ANON__[:194] | 
| 0 | 0 | 0 | 0s | 0s | Encode::clone_encoding | 
| 1 | 1 | 1 | 0s | 0s | Encode::decode | 
| 0 | 0 | 0 | 0s | 0s | Encode::decode_utf8 | 
| 69 | 1 | 1 | 0s | 0s | Encode::define_encoding | 
| 0 | 0 | 0 | 0s | 0s | Encode::encode | 
| 0 | 0 | 0 | 0s | 0s | Encode::encode_utf8 | 
| 0 | 0 | 0 | 0s | 0s | Encode::encodings | 
| 8 | 5 | 4 | 0s | 0s | Encode::find_encoding (recurses: max depth 1, inclusive time 0s) | 
| 0 | 0 | 0 | 0s | 0s | Encode::from_to | 
| 8 | 1 | 1 | 0s | 0s | Encode::getEncoding (recurses: max depth 1, inclusive time 0s) | 
| 0 | 0 | 0 | 0s | 0s | Encode::perlio_ok | 
| 1 | 1 | 1 | 0s | 0s | Encode::predefine_encodings | 
| 0 | 0 | 0 | 0s | 0s | Encode::resolve_alias | 
| 0 | 0 | 0 | 0s | 0s | Encode::utf8::__ANON__[:337] | 
| 0 | 0 | 0 | 0s | 0s | Encode::utf8::__ANON__[:343] | 
| 0 | 0 | 0 | 0s | 0s | Encode::utf8::__ANON__[:359] | 
| 1 | 1 | 1 | 0s | 0s | Encode::utf8::decode_xs (xsub) | 
| Line | State ments  | 
      Time on line  | 
      Calls | Time in subs  | 
      Code | 
|---|---|---|---|---|---|
| 1 | # | ||||
| 2 | # $Id: Encode.pm,v 2.70 2015/02/05 10:52:16 dankogai Exp $ | ||||
| 3 | # | ||||
| 4 | package Encode; | ||||
| 5 | 2 | 0s | 2 | 0s | # spent 0s within Encode::BEGIN@5 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 5 # spent     0s making 1 call to Encode::BEGIN@5
# spent     0s making 1 call to strict::import  | 
| 6 | 2 | 0s | 2 | 0s | # spent 0s within Encode::BEGIN@6 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 6 # spent     0s making 1 call to Encode::BEGIN@6
# spent     0s making 1 call to warnings::import  | 
| 7 | 1 | 0s | 1 | 0s | our $VERSION = sprintf "%d.%02d", q$Revision: 2.70 $ =~ /(\d+)/g; # spent     0s making 1 call to Encode::CORE:match  | 
| 8 | 2 | 0s | 2 | 0s | # spent 0s within Encode::BEGIN@8 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 8 # spent     0s making 1 call to Encode::BEGIN@8
# spent     0s making 1 call to constant::import  | 
| 9 | 2 | 0s | 1 | 0s | # spent 0s within Encode::BEGIN@9 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 9 # spent     0s making 1 call to Encode::BEGIN@9  | 
| 10 | 1 | 0s | 1 | 0s | XSLoader::load( __PACKAGE__, $VERSION ); # spent     0s making 1 call to XSLoader::load  | 
| 11 | |||||
| 12 | 3 | 0s | 3 | 0s | # spent 0s within Encode::BEGIN@12 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 12 # spent     0s making 1 call to Encode::BEGIN@12
# spent     0s making 1 call to Exporter::import
# spent     0s making 1 call to version::vxs::_VERSION  | 
| 13 | |||||
| 14 | # Public, encouraged API is exported by default | ||||
| 15 | |||||
| 16 | 1 | 0s | our @EXPORT = qw( | ||
| 17 | decode decode_utf8 encode encode_utf8 str2bytes bytes2str | ||||
| 18 | encodings find_encoding clone_encoding | ||||
| 19 | ); | ||||
| 20 | 1 | 0s | our @FB_FLAGS = qw( | ||
| 21 | DIE_ON_ERR WARN_ON_ERR RETURN_ON_ERR LEAVE_SRC | ||||
| 22 | PERLQQ HTMLCREF XMLCREF STOP_AT_PARTIAL | ||||
| 23 | ); | ||||
| 24 | 1 | 0s | our @FB_CONSTS = qw( | ||
| 25 | FB_DEFAULT FB_CROAK FB_QUIET FB_WARN | ||||
| 26 | FB_PERLQQ FB_HTMLCREF FB_XMLCREF | ||||
| 27 | ); | ||||
| 28 | 1 | 0s | our @EXPORT_OK = ( | ||
| 29 | qw( | ||||
| 30 | _utf8_off _utf8_on define_encoding from_to is_16bit is_8bit | ||||
| 31 | is_utf8 perlio_ok resolve_alias utf8_downgrade utf8_upgrade | ||||
| 32 | ), | ||||
| 33 | @FB_FLAGS, @FB_CONSTS, | ||||
| 34 | ); | ||||
| 35 | |||||
| 36 | 1 | 0s | our %EXPORT_TAGS = ( | ||
| 37 | all => [ @EXPORT, @EXPORT_OK ], | ||||
| 38 | default => [ @EXPORT ], | ||||
| 39 | fallbacks => [ @FB_CONSTS ], | ||||
| 40 | fallback_all => [ @FB_CONSTS, @FB_FLAGS ], | ||||
| 41 | ); | ||||
| 42 | |||||
| 43 | # Documentation moved after __END__ for speed - NI-S | ||||
| 44 | |||||
| 45 | 1 | 0s | our $ON_EBCDIC = ( ord("A") == 193 ); | ||
| 46 | |||||
| 47 | 2 | 0s | 2 | 0s | # spent 0s within Encode::BEGIN@47 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 47 # spent     0s making 1 call to Encode::BEGIN@47
# spent     0s making 1 call to Exporter::import  | 
| 48 | |||||
| 49 | # Make a %Encoding package variable to allow a certain amount of cheating | ||||
| 50 | 1 | 0s | our %Encoding; | ||
| 51 | 1 | 0s | our %ExtModule; | ||
| 52 | 1 | 0s | require Encode::Config; | ||
| 53 | # See | ||||
| 54 | # https://bugzilla.redhat.com/show_bug.cgi?id=435505#c2 | ||||
| 55 | # to find why sig handlers inside eval{} are disabled. | ||||
| 56 | 1 | 0s | eval { | ||
| 57 | 1 | 0s | local $SIG{__DIE__}; | ||
| 58 | 1 | 0s | local $SIG{__WARN__}; | ||
| 59 | 1 | 0s | require Encode::ConfigLocal; | ||
| 60 | }; | ||||
| 61 | |||||
| 62 | sub encodings { | ||||
| 63 | my %enc; | ||||
| 64 | my $arg = $_[1] || ''; | ||||
| 65 | if ( $arg eq ":all" ) { | ||||
| 66 | %enc = ( %Encoding, %ExtModule ); | ||||
| 67 | } | ||||
| 68 | else { | ||||
| 69 | %enc = %Encoding; | ||||
| 70 | for my $mod ( map { m/::/ ? $_ : "Encode::$_" } @_ ) { | ||||
| 71 | DEBUG and warn $mod; | ||||
| 72 | for my $enc ( keys %ExtModule ) { | ||||
| 73 | $ExtModule{$enc} eq $mod and $enc{$enc} = $mod; | ||||
| 74 | } | ||||
| 75 | } | ||||
| 76 | } | ||||
| 77 | return sort { lc $a cmp lc $b } | ||||
| 78 | grep { !/^(?:Internal|Unicode|Guess)$/o } keys %enc; | ||||
| 79 | } | ||||
| 80 | |||||
| 81 | sub perlio_ok { | ||||
| 82 | my $obj = ref( $_[0] ) ? $_[0] : find_encoding( $_[0] ); | ||||
| 83 | $obj->can("perlio_ok") and return $obj->perlio_ok(); | ||||
| 84 | return 0; # safety net | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | # spent 0s within Encode::define_encoding which was called 69 times, avg 0s/call:
# 69 times (0s+0s) by XSLoader::load at line 92 of XSLoader.pm, avg 0s/call  | ||||
| 88 | 69 | 0s | my $obj = shift; | ||
| 89 | 69 | 0s | my $name = shift; | ||
| 90 | 69 | 0s | $Encoding{$name} = $obj; | ||
| 91 | 69 | 0s | my $lc = lc($name); | ||
| 92 | 69 | 0s | 16 | 0s |     define_alias( $lc => $obj ) unless $lc eq $name;     # spent     0s making 16 calls to Encode::Alias::define_alias, avg 0s/call  | 
| 93 | 69 | 0s | while (@_) { | ||
| 94 | my $alias = shift; | ||||
| 95 | define_alias( $alias, $obj ); | ||||
| 96 | } | ||||
| 97 | 69 | 0s | return $obj; | ||
| 98 | } | ||||
| 99 | |||||
| 100 | # spent 0s within Encode::getEncoding which was called 8 times, avg 0s/call:
# 8 times (0s+0s) by Encode::find_encoding at line 128, avg 0s/call  | ||||
| 101 | 8 | 0s | my ( $class, $name, $skip_external ) = @_; | ||
| 102 | |||||
| 103 | 8 | 0s | 8 | 0s |     $name =~ s/\s+//g; # https://rt.cpan.org/Ticket/Display.html?id=65796     # spent     0s making 8 calls to Encode::CORE:subst, avg 0s/call  | 
| 104 | |||||
| 105 | 8 | 0s | ref($name) && $name->can('renew') and return $name; | ||
| 106 | 8 | 0s | exists $Encoding{$name} and return $Encoding{$name}; | ||
| 107 | 6 | 0s | my $lc = lc $name; | ||
| 108 | 6 | 0s | exists $Encoding{$lc} and return $Encoding{$lc}; | ||
| 109 | |||||
| 110 | 6 | 0s | 6 | 0s |     my $oc = $class->find_alias($name);     # spent     0s making 6 calls to Encode::Alias::find_alias, avg 0s/call, recursion: max depth 1, sum of overlapping time 0s  | 
| 111 | 6 | 0s | defined($oc) and return $oc; | ||
| 112 | 1 | 0s | $lc ne $name and $oc = $class->find_alias($lc); | ||
| 113 | 1 | 0s | defined($oc) and return $oc; | ||
| 114 | |||||
| 115 | 1 | 0s | unless ($skip_external) { | ||
| 116 | 1 | 0s | if ( my $mod = $ExtModule{$name} || $ExtModule{$lc} ) { | ||
| 117 | 1 | 0s | 1 | 0s |             $mod =~ s,::,/,g;             # spent     0s making 1 call to Encode::CORE:subst  | 
| 118 | 1 | 0s | $mod .= '.pm'; | ||
| 119 | 2 | 0s | eval { require $mod; }; | ||
| 120 | 1 | 0s | exists $Encoding{$name} and return $Encoding{$name}; | ||
| 121 | } | ||||
| 122 | } | ||||
| 123 | return; | ||||
| 124 | } | ||||
| 125 | |||||
| 126 | # spent 0s within Encode::find_encoding which was called 8 times, avg 0s/call:
# 3 times (0s+0s) by ExtUtils::MakeMaker::CORE:binmode at line 1175 of ExtUtils/MakeMaker.pm, avg 0s/call
# 2 times (0s+0s) by Encode::Alias::find_alias at line 46 of Encode/Alias.pm, avg 0s/call
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::_init at line 83 of ExtUtils/MakeMaker/Locale.pm
#    once (0s+0s) by Encode::Alias::find_alias at line 62 of Encode/Alias.pm
#    once (0s+0s) by Encode::decode at line 183  | ||||
| 127 | 8 | 0s | my ( $name, $skip_external ) = @_; | ||
| 128 | 8 | 0s | 8 | 0s |     return __PACKAGE__->getEncoding( $name, $skip_external );     # spent     0s making 8 calls to Encode::getEncoding, avg 0s/call, recursion: max depth 1, sum of overlapping time 0s  | 
| 129 | } | ||||
| 130 | |||||
| 131 | sub resolve_alias($) { | ||||
| 132 | my $obj = find_encoding(shift); | ||||
| 133 | defined $obj and return $obj->name; | ||||
| 134 | return; | ||||
| 135 | } | ||||
| 136 | |||||
| 137 | sub clone_encoding($) { | ||||
| 138 | my $obj = find_encoding(shift); | ||||
| 139 | ref $obj or return; | ||||
| 140 | eval { require Storable }; | ||||
| 141 | $@ and return; | ||||
| 142 | return Storable::dclone($obj); | ||||
| 143 | } | ||||
| 144 | |||||
| 145 | sub encode($$;$) { | ||||
| 146 | my ( $name, $string, $check ) = @_; | ||||
| 147 | return undef unless defined $string; | ||||
| 148 | $string .= ''; # stringify; | ||||
| 149 | $check ||= 0; | ||||
| 150 | unless ( defined $name ) { | ||||
| 151 | require Carp; | ||||
| 152 | Carp::croak("Encoding name should not be undef"); | ||||
| 153 | } | ||||
| 154 | my $enc = find_encoding($name); | ||||
| 155 | unless ( defined $enc ) { | ||||
| 156 | require Carp; | ||||
| 157 | Carp::croak("Unknown encoding '$name'"); | ||||
| 158 | } | ||||
| 159 | # For Unicode, warnings need to be caught and re-issued at this level | ||||
| 160 | # so that callers can disable utf8 warnings lexically. | ||||
| 161 | my $octets; | ||||
| 162 | if ( ref($enc) eq 'Encode::Unicode' ) { | ||||
| 163 | my $warn = ''; | ||||
| 164 | { | ||||
| 165 | local $SIG{__WARN__} = sub { $warn = shift }; | ||||
| 166 | $octets = $enc->encode( $string, $check ); | ||||
| 167 | } | ||||
| 168 | warnings::warnif('utf8', $warn) if length $warn; | ||||
| 169 | } | ||||
| 170 | else { | ||||
| 171 | $octets = $enc->encode( $string, $check ); | ||||
| 172 | } | ||||
| 173 | $_[1] = $string if $check and !ref $check and !( $check & LEAVE_SRC() ); | ||||
| 174 | return $octets; | ||||
| 175 | } | ||||
| 176 | 1 | 0s | *str2bytes = \&encode; | ||
| 177 | |||||
| 178 | # spent 0s within Encode::decode which was called:
#    once (0s+0s) by Parse::CPAN::Meta::_slurp at line 92 of Parse/CPAN/Meta.pm  | ||||
| 179 | 1 | 0s | my ( $name, $octets, $check ) = @_; | ||
| 180 | 1 | 0s | return undef unless defined $octets; | ||
| 181 | 1 | 0s | $octets .= ''; | ||
| 182 | 1 | 0s | $check ||= 0; | ||
| 183 | 1 | 0s | 1 | 0s |     my $enc = find_encoding($name);     # spent     0s making 1 call to Encode::find_encoding  | 
| 184 | 1 | 0s | unless ( defined $enc ) { | ||
| 185 | require Carp; | ||||
| 186 | Carp::croak("Unknown encoding '$name'"); | ||||
| 187 | } | ||||
| 188 | # For Unicode, warnings need to be caught and re-issued at this level | ||||
| 189 | # so that callers can disable utf8 warnings lexically. | ||||
| 190 | 1 | 0s | my $string; | ||
| 191 | 1 | 0s | if ( ref($enc) eq 'Encode::Unicode' ) { | ||
| 192 | my $warn = ''; | ||||
| 193 | { | ||||
| 194 | local $SIG{__WARN__} = sub { $warn = shift }; | ||||
| 195 | $string = $enc->decode( $octets, $check ); | ||||
| 196 | } | ||||
| 197 | warnings::warnif('utf8', $warn) if length $warn; | ||||
| 198 | } | ||||
| 199 | else { | ||||
| 200 | 1 | 0s | 2 | 0s |         $string = $enc->decode( $octets, $check );         # spent     0s making 1 call to Encode::Encoding::renewed
        # spent     0s making 1 call to Encode::utf8::decode_xs  | 
| 201 | } | ||||
| 202 | 1 | 0s | 1 | 0s |     $_[1] = $octets if $check and !ref $check and !( $check & LEAVE_SRC() );     # spent     0s making 1 call to Encode::LEAVE_SRC  | 
| 203 | 1 | 0s | return $string; | ||
| 204 | } | ||||
| 205 | 1 | 0s | *bytes2str = \&decode; | ||
| 206 | |||||
| 207 | sub from_to($$$;$) { | ||||
| 208 | my ( $string, $from, $to, $check ) = @_; | ||||
| 209 | return undef unless defined $string; | ||||
| 210 | $check ||= 0; | ||||
| 211 | my $f = find_encoding($from); | ||||
| 212 | unless ( defined $f ) { | ||||
| 213 | require Carp; | ||||
| 214 | Carp::croak("Unknown encoding '$from'"); | ||||
| 215 | } | ||||
| 216 | my $t = find_encoding($to); | ||||
| 217 | unless ( defined $t ) { | ||||
| 218 | require Carp; | ||||
| 219 | Carp::croak("Unknown encoding '$to'"); | ||||
| 220 | } | ||||
| 221 | my $uni = $f->decode($string); | ||||
| 222 | $_[0] = $string = $t->encode( $uni, $check ); | ||||
| 223 | return undef if ( $check && length($uni) ); | ||||
| 224 | return defined( $_[0] ) ? length($string) : undef; | ||||
| 225 | } | ||||
| 226 | |||||
| 227 | sub encode_utf8($) { | ||||
| 228 | my ($str) = @_; | ||||
| 229 | utf8::encode($str); | ||||
| 230 | return $str; | ||||
| 231 | } | ||||
| 232 | |||||
| 233 | 1 | 0s | my $utf8enc; | ||
| 234 | |||||
| 235 | sub decode_utf8($;$) { | ||||
| 236 | my ( $octets, $check ) = @_; | ||||
| 237 | return undef unless defined $octets; | ||||
| 238 | $octets .= ''; | ||||
| 239 | $check ||= 0; | ||||
| 240 | $utf8enc ||= find_encoding('utf8'); | ||||
| 241 | my $string = $utf8enc->decode( $octets, $check ); | ||||
| 242 | $_[0] = $octets if $check and !ref $check and !( $check & LEAVE_SRC() ); | ||||
| 243 | return $string; | ||||
| 244 | } | ||||
| 245 | |||||
| 246 | # sub decode_utf8($;$) { | ||||
| 247 | # my ( $str, $check ) = @_; | ||||
| 248 | # return $str if is_utf8($str); | ||||
| 249 | # if ($check) { | ||||
| 250 | # return decode( "utf8", $str, $check ); | ||||
| 251 | # } | ||||
| 252 | # else { | ||||
| 253 | # return decode( "utf8", $str ); | ||||
| 254 | # return $str; | ||||
| 255 | # } | ||||
| 256 | # } | ||||
| 257 | |||||
| 258 | 1 | 0s | 1 | 0s | predefine_encodings(1); # spent     0s making 1 call to Encode::predefine_encodings  | 
| 259 | |||||
| 260 | # | ||||
| 261 | # This is to restore %Encoding if really needed; | ||||
| 262 | # | ||||
| 263 | |||||
| 264 | # spent 0s within Encode::predefine_encodings which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 258  | ||||
| 265 | 1 | 0s | require Encode::Encoding; | ||
| 266 | 2 | 0s | 2 | 0s | # spent 0s within Encode::BEGIN@266 which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 266     # spent     0s making 1 call to Encode::BEGIN@266
    # spent     0s making 1 call to warnings::unimport  | 
| 267 | 1 | 0s | my $use_xs = shift; | ||
| 268 | 1 | 0s | if ($ON_EBCDIC) { | ||
| 269 | |||||
| 270 | # was in Encode::UTF_EBCDIC | ||||
| 271 | package Encode::UTF_EBCDIC; | ||||
| 272 | push @Encode::UTF_EBCDIC::ISA, 'Encode::Encoding'; | ||||
| 273 | *decode = sub { | ||||
| 274 | my ( undef, $str, $chk ) = @_; | ||||
| 275 | my $res = ''; | ||||
| 276 | for ( my $i = 0 ; $i < length($str) ; $i++ ) { | ||||
| 277 | $res .= | ||||
| 278 | chr( | ||||
| 279 | utf8::unicode_to_native( ord( substr( $str, $i, 1 ) ) ) | ||||
| 280 | ); | ||||
| 281 | } | ||||
| 282 | $_[1] = '' if $chk; | ||||
| 283 | return $res; | ||||
| 284 | }; | ||||
| 285 | *encode = sub { | ||||
| 286 | my ( undef, $str, $chk ) = @_; | ||||
| 287 | my $res = ''; | ||||
| 288 | for ( my $i = 0 ; $i < length($str) ; $i++ ) { | ||||
| 289 | $res .= | ||||
| 290 | chr( | ||||
| 291 | utf8::native_to_unicode( ord( substr( $str, $i, 1 ) ) ) | ||||
| 292 | ); | ||||
| 293 | } | ||||
| 294 | $_[1] = '' if $chk; | ||||
| 295 | return $res; | ||||
| 296 | }; | ||||
| 297 | $Encode::Encoding{Unicode} = | ||||
| 298 | bless { Name => "UTF_EBCDIC" } => "Encode::UTF_EBCDIC"; | ||||
| 299 | } | ||||
| 300 | else { | ||||
| 301 | |||||
| 302 | package Encode::Internal; | ||||
| 303 | 1 | 0s | push @Encode::Internal::ISA, 'Encode::Encoding'; | ||
| 304 | *decode = sub { | ||||
| 305 | my ( undef, $str, $chk ) = @_; | ||||
| 306 | utf8::upgrade($str); | ||||
| 307 | $_[1] = '' if $chk; | ||||
| 308 | return $str; | ||||
| 309 | 1 | 0s | }; | ||
| 310 | 1 | 0s | *encode = \&decode; | ||
| 311 | 1 | 0s | $Encode::Encoding{Unicode} = | ||
| 312 | bless { Name => "Internal" } => "Encode::Internal"; | ||||
| 313 | } | ||||
| 314 | |||||
| 315 | { | ||||
| 316 | |||||
| 317 | # was in Encode::utf8 | ||||
| 318 | 1 | 0s | package Encode::utf8; | ||
| 319 | 1 | 0s | push @Encode::utf8::ISA, 'Encode::Encoding'; | ||
| 320 | |||||
| 321 | # | ||||
| 322 | 1 | 0s | if ($use_xs) { | ||
| 323 | Encode::DEBUG and warn __PACKAGE__, " XS on"; | ||||
| 324 | 1 | 0s | *decode = \&decode_xs; | ||
| 325 | 1 | 0s | *encode = \&encode_xs; | ||
| 326 | } | ||||
| 327 | else { | ||||
| 328 | Encode::DEBUG and warn __PACKAGE__, " XS off"; | ||||
| 329 | *decode = sub { | ||||
| 330 | my ( undef, $octets, $chk ) = @_; | ||||
| 331 | my $str = Encode::decode_utf8($octets); | ||||
| 332 | if ( defined $str ) { | ||||
| 333 | $_[1] = '' if $chk; | ||||
| 334 | return $str; | ||||
| 335 | } | ||||
| 336 | return undef; | ||||
| 337 | }; | ||||
| 338 | *encode = sub { | ||||
| 339 | my ( undef, $string, $chk ) = @_; | ||||
| 340 | my $octets = Encode::encode_utf8($string); | ||||
| 341 | $_[1] = '' if $chk; | ||||
| 342 | return $octets; | ||||
| 343 | }; | ||||
| 344 | } | ||||
| 345 | *cat_decode = sub { # ($obj, $dst, $src, $pos, $trm, $chk) | ||||
| 346 | # currently ignores $chk | ||||
| 347 | my ( undef, undef, undef, $pos, $trm ) = @_; | ||||
| 348 | my ( $rdst, $rsrc, $rpos ) = \@_[ 1, 2, 3 ]; | ||||
| 349 | 2 | 15.6ms | 2 | 15.6ms | # spent 15.6ms within Encode::utf8::BEGIN@349 which was called:
#    once (15.6ms+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 349             # spent  15.6ms making 1 call to Encode::utf8::BEGIN@349
            # spent     0s making 1 call to bytes::import  | 
| 350 | if ( ( my $npos = index( $$rsrc, $trm, $pos ) ) >= 0 ) { | ||||
| 351 | $$rdst .= | ||||
| 352 | substr( $$rsrc, $pos, $npos - $pos + length($trm) ); | ||||
| 353 | $$rpos = $npos + length($trm); | ||||
| 354 | return 1; | ||||
| 355 | } | ||||
| 356 | $$rdst .= substr( $$rsrc, $pos ); | ||||
| 357 | $$rpos = length($$rsrc); | ||||
| 358 | return ''; | ||||
| 359 | 1 | 0s | }; | ||
| 360 | 1 | 0s | $Encode::Encoding{utf8} = | ||
| 361 | bless { Name => "utf8" } => "Encode::utf8"; | ||||
| 362 | 1 | 0s | $Encode::Encoding{"utf-8-strict"} = | ||
| 363 | bless { Name => "utf-8-strict", strict_utf8 => 1 } | ||||
| 364 | => "Encode::utf8"; | ||||
| 365 | } | ||||
| 366 | } | ||||
| 367 | |||||
| 368 | 1 | 0s | 1; | ||
| 369 | |||||
| 370 | __END__ | ||||
# spent 0s within Encode::CORE:match which was called:
#    once (0s+0s) by ExtUtils::MakeMaker::Locale::BEGIN@13 at line 7  | |||||
sub Encode::CORE:subst; # opcode  | |||||
# spent 0s within Encode::LEAVE_SRC which was called:
#    once (0s+0s) by Encode::decode at line 202  | |||||
# spent 0s within Encode::PERLQQ which was called 3 times, avg 0s/call:
#    once (0s+0s) by XSLoader::load at line 92 of XSLoader.pm
#    once (0s+0s) by Parse::CPAN::Meta::_slurp at line 92 of Parse/CPAN/Meta.pm
#    once (0s+0s) by PerlIO::import at line 16 of PerlIO/encoding.pm  | |||||
# spent 0s within Encode::STOP_AT_PARTIAL which was called:
#    once (0s+0s) by PerlIO::import at line 16 of PerlIO/encoding.pm  | |||||
# spent 0s within Encode::WARN_ON_ERR which was called:
#    once (0s+0s) by PerlIO::import at line 16 of PerlIO/encoding.pm  | |||||
# spent 0s within Encode::utf8::decode_xs which was called:
#    once (0s+0s) by Encode::decode at line 200  |