Filename | /usr/lib/perl/5.10/Encode/Encoding.pm |
Statements | Executed 558 statements in 2.51ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
546 | 1 | 1 | 1.46ms | 1.46ms | renewed | Encode::Encoding::
1 | 1 | 1 | 20µs | 24µs | BEGIN@4 | Encode::Encoding::
1 | 1 | 1 | 9µs | 22µs | BEGIN@5 | Encode::Encoding::
1 | 1 | 1 | 5µs | 5µs | CORE:match (opcode) | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | DEBUG | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | DESTROY | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | Define | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | decode | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | encode | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | fromUnicode | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | mime_name | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | name | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | needs_lines | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | perlio_ok | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | renew | Encode::Encoding::
0 | 0 | 0 | 0s | 0s | toUnicode | Encode::Encoding::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Encode::Encoding; | ||||
2 | |||||
3 | # Base class for classes which implement encodings | ||||
4 | 3 | 29µs | 2 | 29µs | # spent 24µs (20+4) within Encode::Encoding::BEGIN@4 which was called:
# once (20µs+4µs) by Encode::predefine_encodings at line 4 # spent 24µs making 1 call to Encode::Encoding::BEGIN@4
# spent 4µs making 1 call to strict::import |
5 | 3 | 465µs | 2 | 36µs | # spent 22µs (9+13) within Encode::Encoding::BEGIN@5 which was called:
# once (9µs+13µs) by Encode::predefine_encodings at line 5 # spent 22µs making 1 call to Encode::Encoding::BEGIN@5
# spent 13µs making 1 call to warnings::import |
6 | 3 | 22µs | 1 | 5µs | our $VERSION = do { my @r = ( q$Revision: 2.5 $ =~ /\d+/g ); sprintf "%d." . "%02d" x $#r, @r }; # spent 5µs making 1 call to Encode::Encoding::CORE:match |
7 | |||||
8 | 1 | 1µs | require Encode; | ||
9 | |||||
10 | sub DEBUG { 0 } | ||||
11 | |||||
12 | sub Define { | ||||
13 | my $obj = shift; | ||||
14 | my $canonical = shift; | ||||
15 | $obj = bless { Name => $canonical }, $obj unless ref $obj; | ||||
16 | |||||
17 | # warn "$canonical => $obj\n"; | ||||
18 | Encode::define_encoding( $obj, $canonical, @_ ); | ||||
19 | } | ||||
20 | |||||
21 | sub name { return shift->{'Name'} } | ||||
22 | |||||
23 | sub mime_name{ | ||||
24 | require Encode::MIME::Name; | ||||
25 | return Encode::MIME::Name::get_mime_name(shift->name); | ||||
26 | } | ||||
27 | |||||
28 | # sub renew { return $_[0] } | ||||
29 | |||||
30 | sub renew { | ||||
31 | my $self = shift; | ||||
32 | my $clone = bless {%$self} => ref($self); | ||||
33 | $clone->{renewed}++; # so the caller can see it | ||||
34 | DEBUG and warn $clone->{renewed}; | ||||
35 | return $clone; | ||||
36 | } | ||||
37 | |||||
38 | 546 | 1.98ms | # spent 1.46ms within Encode::Encoding::renewed which was called 546 times, avg 3µs/call:
# 546 times (1.46ms+0s) by Encode::utf8::decode_xs at line 174 of Encode.pm, avg 3µs/call | ||
39 | |||||
40 | 1 | 2µs | *new_sequence = \&renew; | ||
41 | |||||
42 | sub needs_lines { 0 } | ||||
43 | |||||
44 | sub perlio_ok { | ||||
45 | eval { require PerlIO::encoding }; | ||||
46 | return $@ ? 0 : 1; | ||||
47 | } | ||||
48 | |||||
49 | # (Temporary|legacy) methods | ||||
50 | |||||
51 | sub toUnicode { shift->decode(@_) } | ||||
52 | sub fromUnicode { shift->encode(@_) } | ||||
53 | |||||
54 | # | ||||
55 | # Needs to be overloaded or just croak | ||||
56 | # | ||||
57 | |||||
58 | sub encode { | ||||
59 | require Carp; | ||||
60 | my $obj = shift; | ||||
61 | my $class = ref($obj) ? ref($obj) : $obj; | ||||
62 | Carp::croak( $class . "->encode() not defined!" ); | ||||
63 | } | ||||
64 | |||||
65 | sub decode { | ||||
66 | require Carp; | ||||
67 | my $obj = shift; | ||||
68 | my $class = ref($obj) ? ref($obj) : $obj; | ||||
69 | Carp::croak( $class . "->encode() not defined!" ); | ||||
70 | } | ||||
71 | |||||
72 | sub DESTROY { } | ||||
73 | |||||
74 | 1 | 6µs | 1; | ||
75 | __END__ | ||||
# spent 5µs within Encode::Encoding::CORE:match which was called:
# once (5µs+0s) by Encode::predefine_encodings at line 6 |