← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 11:58:52 2013
Reported on Tue Oct 15 12:01:33 2013

Filename/usr/share/perl5/MIME/Type.pm
StatementsExecuted 15 statements in 751µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11118µs84µsMIME::Type::::BEGIN@18MIME::Type::BEGIN@18
11116µs42µsMIME::Type::::BEGIN@6MIME::Type::BEGIN@6
11112µs64µsMIME::Type::::BEGIN@12MIME::Type::BEGIN@12
1119µs13µsMIME::Type::::BEGIN@10MIME::Type::BEGIN@10
0000s0sMIME::Type::::encodingMIME::Type::encoding
0000s0sMIME::Type::::equalsMIME::Type::equals
0000s0sMIME::Type::::extensionsMIME::Type::extensions
0000s0sMIME::Type::::initMIME::Type::init
0000s0sMIME::Type::::isAsciiMIME::Type::isAscii
0000s0sMIME::Type::::isBinaryMIME::Type::isBinary
0000s0sMIME::Type::::isRegisteredMIME::Type::isRegistered
0000s0sMIME::Type::::isSignatureMIME::Type::isSignature
0000s0sMIME::Type::::mainTypeMIME::Type::mainType
0000s0sMIME::Type::::mediaTypeMIME::Type::mediaType
0000s0sMIME::Type::::newMIME::Type::new
0000s0sMIME::Type::::simplifiedMIME::Type::simplified
0000s0sMIME::Type::::subTypeMIME::Type::subType
0000s0sMIME::Type::::systemMIME::Type::system
0000s0sMIME::Type::::typeMIME::Type::type
Call graph for these subroutines as a Graphviz dot language file.
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.
5package MIME::Type;
6338µs267µs
# spent 42µs (16+26) within MIME::Type::BEGIN@6 which was called: # once (16µs+26µs) by MIME::Types::BEGIN@13 at line 6
use vars '$VERSION';
# spent 42µs making 1 call to MIME::Type::BEGIN@6 # spent 26µs making 1 call to vars::import
71900ns$VERSION = '1.30';
8
9
10326µs217µs
# spent 13µs (9+4) within MIME::Type::BEGIN@10 which was called: # once (9µs+4µs) by MIME::Types::BEGIN@13 at line 10
use strict;
# spent 13µs making 1 call to MIME::Type::BEGIN@10 # spent 4µs making 1 call to strict::import
11
12340µs2116µs
# spent 64µs (12+52) within MIME::Type::BEGIN@12 which was called: # once (12µs+52µs) by MIME::Types::BEGIN@13 at line 12
use Carp 'croak';
# spent 64µs making 1 call to MIME::Type::BEGIN@12 # spent 52µs making 1 call to Exporter::import
13
14
15#-------------------------------------------
16
17
18166µs
# spent 84µs (18+66) within MIME::Type::BEGIN@18 which was called: # once (18µs+66µs) by MIME::Types::BEGIN@13 at line 20
use overload '""' => 'type'
# spent 66µs making 1 call to overload::import
19 , cmp => 'equals'
203631µs184µs ;
# spent 84µs making 1 call to MIME::Type::BEGIN@18
21
22#-------------------------------------------
23
24
25sub new(@) { (bless {}, shift)->init( {@_} ) }
26
27sub init($)
28{ my ($self, $args) = @_;
29
30 $self->{MT_type} = $args->{type}
31 or croak "ERROR: Type parameter is obligatory.";
32
33 $self->{MT_simplified} = $args->{simplified}
34 || ref($self)->simplified($args->{type});
35
36 $self->{MT_extensions} = $args->{extensions} || [];
37
38 $self->{MT_encoding}
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
52sub type() {shift->{MT_type}}
53
54#-------------------------------------------
55
56
57sub simplified(;$)
58{ my $thing = shift;
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"
64 : $mime =~ m!text! ? "text/plain" # some silly mailers...
65 : undef;
66}
67
68#-------------------------------------------
69
70
71sub extensions() { @{shift->{MT_extensions}} }
72
73#-------------------------------------------
74
75
76sub encoding() {shift->{MT_encoding}}
77
78#-------------------------------------------
79
80
81sub system() {shift->{MT_system}}
82
83#-------------------------------------------
84
85
86sub mediaType() {shift->{MT_simplified} =~ m!^([\w-]+)/! ? $1 : undef}
87
88sub mainType() {shift->mediaType} # Backwards compatibility
89
90#-------------------------------------------
91
92
93sub subType() {shift->{MT_simplified} =~ m!/([\w-]+)$! ? $1 : undef}
94
95#-------------------------------------------
96
97
98sub isRegistered()
99{ local $_ = shift->{MT_type};
100 not (m/^[xX]\-/ || m!/[xX]\-!);
101}
102
103
104#-------------------------------------------
105
106
107sub isBinary() { shift->{MT_encoding} eq 'base64' }
108
109#-------------------------------------------
110
111
112sub isAscii() { shift->{MT_encoding} ne 'base64' }
113
114#-------------------------------------------
115
116
117# simplified names only!
118110µsmy %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
123sub isSignature() { $sigs{shift->{MT_simplified}} }
124
125#-------------------------------------------
126
127
128sub 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
13815µs1;