| File | /usr/lib/perl5/vendor_perl/5.10.1/MIME/Type.pm |
| Statements Executed | 10504 |
| Statement Execution Time | 114ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1116 | 2 | 2 | 30.0ms | 40.4ms | MIME::Type::simplified |
| 558 | 1 | 1 | 29.1ms | 64.1ms | MIME::Type::init |
| 1562 | 2 | 2 | 16.0ms | 16.0ms | MIME::Type::CORE:match (opcode) |
| 558 | 1 | 1 | 13.1ms | 77.1ms | MIME::Type::new |
| 446 | 1 | 1 | 8.37ms | 14.0ms | MIME::Type::mediaType |
| 557 | 1 | 1 | 5.88ms | 5.88ms | MIME::Type::extensions |
| 558 | 1 | 1 | 4.73ms | 4.73ms | MIME::Type::system |
| 1 | 1 | 1 | 50µs | 182µs | MIME::Type::BEGIN@6 |
| 1 | 1 | 1 | 37µs | 560µs | MIME::Type::BEGIN@18 |
| 1 | 1 | 1 | 31µs | 42µs | MIME::Type::BEGIN@10 |
| 1 | 1 | 1 | 30µs | 135µs | MIME::Type::BEGIN@12 |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::encoding |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::equals |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::isAscii |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::isBinary |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::isRegistered |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::isSignature |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::mainType |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::subType |
| 0 | 0 | 0 | 0s | 0s | MIME::Type::type |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | # Copyrights 1999,2001-2010 by Mark Overmeer. | ||||
| 2 | # For other contributors see ChangeLog. | ||||
| 3 | # See the manual pages for details on the licensing terms. | ||||
| 4 | # Pod stripped from pm file by OODoc 1.06. | ||||
| 5 | package MIME::Type; | ||||
| 6 | 3 | 139µs | 2 | 315µs | # spent 182µs (50+133) within MIME::Type::BEGIN@6 which was called
# once (50µs+133µs) by MIME::Types::BEGIN@13 at line 6 # spent 182µs making 1 call to MIME::Type::BEGIN@6
# spent 133µs making 1 call to vars::import |
| 7 | 1 | 3µs | $VERSION = '1.29'; | ||
| 8 | |||||
| 9 | |||||
| 10 | 3 | 83µs | 2 | 54µs | # spent 42µs (31+11) within MIME::Type::BEGIN@10 which was called
# once (31µs+11µs) by MIME::Types::BEGIN@13 at line 10 # spent 42µs making 1 call to MIME::Type::BEGIN@10
# spent 11µs making 1 call to strict::import |
| 11 | |||||
| 12 | 3 | 95µs | 2 | 240µs | # spent 135µs (30+105) within MIME::Type::BEGIN@12 which was called
# once (30µs+105µs) by MIME::Types::BEGIN@13 at line 12 # spent 135µs making 1 call to MIME::Type::BEGIN@12
# spent 105µs making 1 call to Exporter::import |
| 13 | |||||
| 14 | |||||
| 15 | #------------------------------------------- | ||||
| 16 | |||||
| 17 | |||||
| 18 | # spent 560µs (37+523) within MIME::Type::BEGIN@18 which was called
# once (37µs+523µs) by MIME::Types::BEGIN@13 at line 20 # spent 524µs making 1 call to overload::import | ||||
| 19 | , cmp => 'equals' | ||||
| 20 | 3 | 2.30ms | 1 | 560µs | ; # spent 560µs making 1 call to MIME::Type::BEGIN@18 |
| 21 | |||||
| 22 | #------------------------------------------- | ||||
| 23 | |||||
| 24 | |||||
| 25 | 558 | 13.0ms | 558 | 64.1ms | # spent 77.1ms (13.1+64.1) within MIME::Type::new which was called 558 times, avg 138µs/call:
# 558 times (13.1ms+64.1ms) by MIME::Types::init at line 38 of MIME/Types.pm, avg 138µs/call # spent 64.1ms making 558 calls to MIME::Type::init, avg 115µs/call |
| 26 | |||||
| 27 | sub init($) | ||||
| 28 | 3906 | 25.6ms | # spent 64.1ms (29.1+34.9) within MIME::Type::init which was called 558 times, avg 115µs/call:
# 558 times (29.1ms+34.9ms) by MIME::Type::new at line 25, avg 115µs/call | ||
| 29 | |||||
| 30 | $self->{MT_type} = $args->{type} | ||||
| 31 | or croak "ERROR: Type parameter is obligatory."; | ||||
| 32 | |||||
| 33 | $self->{MT_simplified} = $args->{simplified} # spent 20.9ms making 558 calls to MIME::Type::simplified, avg 38µs/call | ||||
| 34 | || ref($self)->simplified($args->{type}); | ||||
| 35 | |||||
| 36 | $self->{MT_extensions} = $args->{extensions} || []; | ||||
| 37 | |||||
| 38 | $self->{MT_encoding} # spent 14.0ms making 446 calls to MIME::Type::mediaType, avg 31µs/call | ||||
| 39 | = $args->{encoding} ? $args->{encoding} | ||||
| 40 | : $self->mediaType eq 'text' ? 'quoted-printable' | ||||
| 41 | : 'base64'; | ||||
| 42 | |||||
| 43 | $self->{MT_system} = $args->{system} | ||||
| 44 | if defined $args->{system}; | ||||
| 45 | |||||
| 46 | $self; | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | #------------------------------------------- | ||||
| 50 | |||||
| 51 | |||||
| 52 | sub type() {shift->{MT_type}} | ||||
| 53 | |||||
| 54 | #------------------------------------------- | ||||
| 55 | |||||
| 56 | |||||
| 57 | sub simplified(;$) | ||||
| 58 | 4464 | 45.5ms | # spent 40.4ms (30.0+10.4) within MIME::Type::simplified which was called 1116 times, avg 36µs/call:
# 558 times (15.7ms+5.19ms) by MIME::Type::init at line 33, avg 38µs/call
# 558 times (14.3ms+5.19ms) by MIME::Types::init at line 37 of MIME/Types.pm, avg 35µs/call | ||
| 59 | return $thing->{MT_simplified} unless @_; | ||||
| 60 | |||||
| 61 | my $mime = shift; | ||||
| 62 | |||||
| 63 | $mime =~ m!^\s*(?:x\-)?([\w.+-]+)/(?:x\-)?([\w.+-]+)\s*$!i ? lc "$1/$2" # spent 10.4ms making 1116 calls to MIME::Type::CORE:match, avg 9µs/call | ||||
| 64 | : $mime =~ m!text! ? "text/plain" # some silly mailers... | ||||
| 65 | : undef; | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | #------------------------------------------- | ||||
| 69 | |||||
| 70 | |||||
| 71 | 557 | 6.91ms | # spent 5.88ms within MIME::Type::extensions which was called 557 times, avg 11µs/call:
# 557 times (5.88ms+0s) by MIME::Types::create_type_index at line 65 of MIME/Types.pm, avg 11µs/call | ||
| 72 | |||||
| 73 | #------------------------------------------- | ||||
| 74 | |||||
| 75 | |||||
| 76 | sub encoding() {shift->{MT_encoding}} | ||||
| 77 | |||||
| 78 | #------------------------------------------- | ||||
| 79 | |||||
| 80 | |||||
| 81 | 558 | 6.20ms | # spent 4.73ms within MIME::Type::system which was called 558 times, avg 8µs/call:
# 558 times (4.73ms+0s) by MIME::Types::create_type_index at line 58 of MIME/Types.pm, avg 8µs/call | ||
| 82 | |||||
| 83 | #------------------------------------------- | ||||
| 84 | |||||
| 85 | |||||
| 86 | 446 | 14.1ms | 446 | 5.61ms | # spent 14.0ms (8.37+5.61) within MIME::Type::mediaType which was called 446 times, avg 31µs/call:
# 446 times (8.37ms+5.61ms) by MIME::Type::init at line 38, avg 31µs/call # spent 5.61ms making 446 calls to MIME::Type::CORE:match, avg 13µs/call |
| 87 | |||||
| 88 | sub mainType() {shift->mediaType} # Backwards compatibility | ||||
| 89 | |||||
| 90 | #------------------------------------------- | ||||
| 91 | |||||
| 92 | |||||
| 93 | sub subType() {shift->{MT_simplified} =~ m!/([\w-]+)$! ? $1 : undef} | ||||
| 94 | |||||
| 95 | #------------------------------------------- | ||||
| 96 | |||||
| 97 | |||||
| 98 | sub isRegistered() | ||||
| 99 | { local $_ = shift->{MT_type}; | ||||
| 100 | not (m/^[xX]\-/ || m!/[xX]\-!); | ||||
| 101 | } | ||||
| 102 | |||||
| 103 | |||||
| 104 | #------------------------------------------- | ||||
| 105 | |||||
| 106 | |||||
| 107 | sub isBinary() { shift->{MT_encoding} eq 'base64' } | ||||
| 108 | |||||
| 109 | #------------------------------------------- | ||||
| 110 | |||||
| 111 | |||||
| 112 | sub isAscii() { shift->{MT_encoding} ne 'base64' } | ||||
| 113 | |||||
| 114 | #------------------------------------------- | ||||
| 115 | |||||
| 116 | |||||
| 117 | # simplified names only! | ||||
| 118 | 1 | 20µs | my %sigs = map { ($_ => 1) } | ||
| 119 | qw(application/pgp-keys application/pgp application/pgp-signature | ||||
| 120 | application/pkcs10 application/pkcs7-mime application/pkcs7-signature | ||||
| 121 | text/vCard); | ||||
| 122 | |||||
| 123 | sub isSignature() { $sigs{shift->{MT_simplified}} } | ||||
| 124 | |||||
| 125 | #------------------------------------------- | ||||
| 126 | |||||
| 127 | |||||
| 128 | sub equals($) | ||||
| 129 | { my ($self, $other) = @_; | ||||
| 130 | |||||
| 131 | my $type = ref $other | ||||
| 132 | ? $other->simplified | ||||
| 133 | : (ref $self)->simplified($other); | ||||
| 134 | |||||
| 135 | $self->simplified cmp $type; | ||||
| 136 | } | ||||
| 137 | |||||
| 138 | 1 | 16µs | 1; | ||
# spent 16.0ms within MIME::Type::CORE:match which was called 1562 times, avg 10µs/call:
# 1116 times (10.4ms+0s) by MIME::Type::simplified at line 63 of MIME/Type.pm, avg 9µs/call
# 446 times (5.61ms+0s) by MIME::Type::mediaType at line 86 of MIME/Type.pm, avg 13µs/call |