← 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:02:14 2013

Filename/usr/share/perl5/MARC/Charset/Code.pm
StatementsExecuted 20 statements in 791µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1111.02ms2.50msMARC::Charset::Code::::BEGIN@8MARC::Charset::Code::BEGIN@8
11144µs60µsMARC::Charset::Code::::BEGIN@4MARC::Charset::Code::BEGIN@4
11117µs22µsMARC::Charset::Code::::BEGIN@3MARC::Charset::Code::BEGIN@3
11114µs104µsMARC::Charset::Code::::BEGIN@5MARC::Charset::Code::BEGIN@5
11112µs46µsMARC::Charset::Code::::BEGIN@7MARC::Charset::Code::BEGIN@7
11111µs50µsMARC::Charset::Code::::BEGIN@6MARC::Charset::Code::BEGIN@6
0000s0sMARC::Charset::Code::::char_valueMARC::Charset::Code::char_value
0000s0sMARC::Charset::Code::::charset_nameMARC::Charset::Code::charset_name
0000s0sMARC::Charset::Code::::charset_valueMARC::Charset::Code::charset_value
0000s0sMARC::Charset::Code::::default_charset_groupMARC::Charset::Code::default_charset_group
0000s0sMARC::Charset::Code::::get_escapeMARC::Charset::Code::get_escape
0000s0sMARC::Charset::Code::::marc8_hash_codeMARC::Charset::Code::marc8_hash_code
0000s0sMARC::Charset::Code::::marc_valueMARC::Charset::Code::marc_value
0000s0sMARC::Charset::Code::::to_stringMARC::Charset::Code::to_string
0000s0sMARC::Charset::Code::::utf8_hash_codeMARC::Charset::Code::utf8_hash_code
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MARC::Charset::Code;
2
3329µs226µs
# spent 22µs (17+4) within MARC::Charset::Code::BEGIN@3 which was called: # once (17µs+4µs) by MARC::Charset::Table::BEGIN@38 at line 3
use strict;
# spent 22µs making 1 call to MARC::Charset::Code::BEGIN@3 # spent 4µs making 1 call to strict::import
4369µs276µs
# spent 60µs (44+16) within MARC::Charset::Code::BEGIN@4 which was called: # once (44µs+16µs) by MARC::Charset::Table::BEGIN@38 at line 4
use warnings;
# spent 60µs making 1 call to MARC::Charset::Code::BEGIN@4 # spent 16µs making 1 call to warnings::import
5341µs2193µs
# spent 104µs (14+90) within MARC::Charset::Code::BEGIN@5 which was called: # once (14µs+90µs) by MARC::Charset::Table::BEGIN@38 at line 5
use base qw(Class::Accessor);
# spent 104µs making 1 call to MARC::Charset::Code::BEGIN@5 # spent 90µs making 1 call to base::import
6332µs289µs
# spent 50µs (11+39) within MARC::Charset::Code::BEGIN@6 which was called: # once (11µs+39µs) by MARC::Charset::Table::BEGIN@38 at line 6
use Carp qw(croak);
# spent 50µs making 1 call to MARC::Charset::Code::BEGIN@6 # spent 39µs making 1 call to Exporter::import
7333µs280µs
# spent 46µs (12+34) within MARC::Charset::Code::BEGIN@7 which was called: # once (12µs+34µs) by MARC::Charset::Table::BEGIN@38 at line 7
use Encode qw(encode_utf8);
# spent 46µs making 1 call to MARC::Charset::Code::BEGIN@7 # spent 34µs making 1 call to Exporter::import
83573µs22.84ms
# spent 2.50ms (1.02+1.48) within MARC::Charset::Code::BEGIN@8 which was called: # once (1.02ms+1.48ms) by MARC::Charset::Table::BEGIN@38 at line 8
use MARC::Charset::Constants qw(:all);
# spent 2.50ms making 1 call to MARC::Charset::Code::BEGIN@8 # spent 342µs making 1 call to Exporter::import
9
10111µs1295µsMARC::Charset::Code
# spent 295µs making 1 call to Class::Accessor::mk_accessors
11 ->mk_accessors(qw(marc ucs name charset is_combining alt));
12
13=head1 NAME
14
- -
61sub char_value()
62{
63 return chr(hex(shift->ucs()));
64}
65
66=head2 marc_value()
67
- -
72sub marc_value
73{
74 my $code = shift;
75 my $marc = $code->marc();
76 return chr(hex($marc)) unless $code->charset_name eq 'CJK';
77 return
78 chr(hex(substr($marc,0,2))) .
79 chr(hex(substr($marc,2,2))) .
80 chr(hex(substr($marc,4,2)));
81}
82
83
84=head2 charset_name()
85
- -
90sub charset_name()
91{
92 return MARC::Charset::Constants::charset_name(shift->charset_value());
93}
94
95=head2 to_string()
96
- -
101sub to_string
102{
103 my $self = shift;
104 my $str =
105 $self->name() . ': ' .
106 'charset_code=' . $self->charset() . ' ' .
107 'marc=' . $self->marc() . ' ' .
108 'ucs=' . $self->ucs() . ' ';
109
110 $str .= ' combining' if $self->is_combining();
111 return $str;
112}
113
114
115=head2 marc8_hash_code()
116
- -
123sub marc8_hash_code
124{
125 my $self = shift;
126 return sprintf('%s:%s', $self->charset_value(), $self->marc_value());
127}
128
129
130=head2 utf8_hash_code()
131
- -
136sub utf8_hash_code
137{
138 return int(hex(shift->ucs()));
139}
140
141
142=head2 default_charset_group
143
- -
149sub default_charset_group
150{
151 my $charset = shift->charset_value();
152
153 return 'G0'
154 if $charset eq ASCII_DEFAULT
155 or $charset eq GREEK_SYMBOLS
156 or $charset eq SUBSCRIPTS
157 or $charset eq SUPERSCRIPTS
158 or $charset eq BASIC_LATIN
159 or $charset eq BASIC_ARABIC
160 or $charset eq BASIC_CYRILLIC
161 or $charset eq BASIC_GREEK
162 or $charset eq BASIC_HEBREW
163 or $charset eq CJK;
164
165 return 'G1';
166}
167
168
169=head2 get_marc8_escape
170
- -
176sub get_escape
177{
178 my $charset = shift->charset_value();
179
180 return ESCAPE . $charset
181 if $charset eq ASCII_DEFAULT
182 or $charset eq GREEK_SYMBOLS
183 or $charset eq SUBSCRIPTS
184 or $charset eq SUPERSCRIPTS;
185
186 return ESCAPE . SINGLE_G0_A . $charset
187 if $charset eq ASCII_DEFAULT
188 or $charset eq BASIC_LATIN
189 or $charset eq BASIC_ARABIC
190 or $charset eq BASIC_CYRILLIC
191 or $charset eq BASIC_GREEK
192 or $charset eq BASIC_HEBREW;
193
194 return ESCAPE . SINGLE_G1_A . $charset
195 if $charset eq EXTENDED_ARABIC
196 or $charset eq EXTENDED_LATIN
197 or $charset eq EXTENDED_CYRILLIC;
198
199 return ESCAPE . MULTI_G0_A . CJK
200 if $charset eq CJK;
201}
202
203=head2 charset_value
204
- -
209sub charset_value
210{
211 return chr(hex(shift->charset()));
212}
213
- -
21614µs1;