← 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 17:10:45 2013
Reported on Tue Oct 15 17:11:27 2013

Filename/usr/share/perl5/YAML/Types.pm
StatementsExecuted 32 statements in 3.58ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11149.4ms52.5msYAML::Type::code::::BEGIN@137 YAML::Type::code::BEGIN@137
11179µs184µsYAML::Type::regexp::::BEGIN@200 YAML::Type::regexp::BEGIN@200
11133µs43µsYAML::Types::::BEGIN@3 YAML::Types::BEGIN@3
11131µs66µsYAML::Types::::BEGIN@4 YAML::Types::BEGIN@4
11126µs82µsYAML::Types::::BEGIN@6 YAML::Types::BEGIN@6
11121µs84µsYAML::Type::blessed::::BEGIN@16YAML::Type::blessed::BEGIN@16
11119µs95µsYAML::Types::::BEGIN@5 YAML::Types::BEGIN@5
11118µs42µsYAML::Type::glob::::BEGIN@97 YAML::Type::glob::BEGIN@97
11118µs50µsYAML::Type::blessed::::BEGIN@22YAML::Type::blessed::BEGIN@22
0000s0sYAML::Type::blessed::::yaml_dumpYAML::Type::blessed::yaml_dump
0000s0sYAML::Type::code::::__ANON__[:163] YAML::Type::code::__ANON__[:163]
0000s0sYAML::Type::code::::__ANON__[:171] YAML::Type::code::__ANON__[:171]
0000s0sYAML::Type::code::::__ANON__[:172] YAML::Type::code::__ANON__[:172]
0000s0sYAML::Type::code::::yaml_dump YAML::Type::code::yaml_dump
0000s0sYAML::Type::code::::yaml_load YAML::Type::code::yaml_load
0000s0sYAML::Type::glob::::yaml_dump YAML::Type::glob::yaml_dump
0000s0sYAML::Type::glob::::yaml_load YAML::Type::glob::yaml_load
0000s0sYAML::Type::ref::::yaml_dump YAML::Type::ref::yaml_dump
0000s0sYAML::Type::ref::::yaml_load YAML::Type::ref::yaml_load
0000s0sYAML::Type::regexp::::__ANON__[:201] YAML::Type::regexp::__ANON__[:201]
0000s0sYAML::Type::regexp::::__ANON__[:202] YAML::Type::regexp::__ANON__[:202]
0000s0sYAML::Type::regexp::::__ANON__[:203] YAML::Type::regexp::__ANON__[:203]
0000s0sYAML::Type::regexp::::__ANON__[:204] YAML::Type::regexp::__ANON__[:204]
0000s0sYAML::Type::regexp::::__ANON__[:205] YAML::Type::regexp::__ANON__[:205]
0000s0sYAML::Type::regexp::::__ANON__[:206] YAML::Type::regexp::__ANON__[:206]
0000s0sYAML::Type::regexp::::__ANON__[:207] YAML::Type::regexp::__ANON__[:207]
0000s0sYAML::Type::regexp::::__ANON__[:208] YAML::Type::regexp::__ANON__[:208]
0000s0sYAML::Type::regexp::::__ANON__[:209] YAML::Type::regexp::__ANON__[:209]
0000s0sYAML::Type::regexp::::__ANON__[:210] YAML::Type::regexp::__ANON__[:210]
0000s0sYAML::Type::regexp::::__ANON__[:211] YAML::Type::regexp::__ANON__[:211]
0000s0sYAML::Type::regexp::::__ANON__[:212] YAML::Type::regexp::__ANON__[:212]
0000s0sYAML::Type::regexp::::__ANON__[:213] YAML::Type::regexp::__ANON__[:213]
0000s0sYAML::Type::regexp::::__ANON__[:214] YAML::Type::regexp::__ANON__[:214]
0000s0sYAML::Type::regexp::::__ANON__[:215] YAML::Type::regexp::__ANON__[:215]
0000s0sYAML::Type::regexp::::__ANON__[:216] YAML::Type::regexp::__ANON__[:216]
0000s0sYAML::Type::regexp::::__ANON__[:225] YAML::Type::regexp::__ANON__[:225]
0000s0sYAML::Type::regexp::::yaml_dump YAML::Type::regexp::yaml_dump
0000s0sYAML::Type::regexp::::yaml_load YAML::Type::regexp::yaml_load
0000s0sYAML::Type::undef::::yaml_dump YAML::Type::undef::yaml_dump
0000s0sYAML::Type::undef::::yaml_load YAML::Type::undef::yaml_load
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package YAML::Types;
2
3363µs253µs
# spent 43µs (33+10) within YAML::Types::BEGIN@3 which was called: # once (33µs+10µs) by YAML::Loader::BEGIN@7 at line 3
use strict;
# spent 43µs making 1 call to YAML::Types::BEGIN@3 # spent 10µs making 1 call to strict::import
4362µs2101µs
# spent 66µs (31+35) within YAML::Types::BEGIN@4 which was called: # once (31µs+35µs) by YAML::Loader::BEGIN@7 at line 4
use warnings;
# spent 66µs making 1 call to YAML::Types::BEGIN@4 # spent 35µs making 1 call to warnings::import
5351µs2170µs
# spent 95µs (19+76) within YAML::Types::BEGIN@5 which was called: # once (19µs+76µs) by YAML::Loader::BEGIN@7 at line 5
use YAML::Base;
# spent 95µs making 1 call to YAML::Types::BEGIN@5 # spent 76µs making 1 call to Exporter::import
63133µs2138µs
# spent 82µs (26+56) within YAML::Types::BEGIN@6 which was called: # once (26µs+56µs) by YAML::Loader::BEGIN@7 at line 6
use YAML::Node;
# spent 82µs making 1 call to YAML::Types::BEGIN@6 # spent 56µs making 1 call to Exporter::import
7
812µsour $VERSION = '0.71';
9129µsour @ISA = 'YAML::Base';
10
11# XXX These classes and their APIs could still use some refactoring,
12# but at least they work for now.
13#-------------------------------------------------------------------------------
14package YAML::Type::blessed;
15
163112µs2146µs
# spent 84µs (21+63) within YAML::Type::blessed::BEGIN@16 which was called: # once (21µs+63µs) by YAML::Loader::BEGIN@7 at line 16
use YAML::Base; # XXX
# spent 84µs making 1 call to YAML::Type::blessed::BEGIN@16 # spent 63µs making 1 call to Exporter::import
17
18sub yaml_dump {
19 my $self = shift;
20 my ($value) = @_;
21 my ($class, $type) = YAML::Base->node_info($value);
223827µs282µs
# spent 50µs (18+32) within YAML::Type::blessed::BEGIN@22 which was called: # once (18µs+32µs) by YAML::Loader::BEGIN@7 at line 22
no strict 'refs';
# spent 50µs making 1 call to YAML::Type::blessed::BEGIN@22 # spent 32µs making 1 call to strict::unimport
23 my $kind = lc($type) . ':';
24 my $tag = ${$class . '::ClassTag'} ||
25 "!perl/$kind$class";
26 if ($type eq 'REF') {
27 YAML::Node->new(
28 {(&YAML::VALUE, ${$_[0]})}, $tag
29 );
30 }
31 elsif ($type eq 'SCALAR') {
32 $_[1] = $$value;
33 YAML::Node->new($_[1], $tag);
34 } else {
35 YAML::Node->new($value, $tag);
36 }
37}
38
39#-------------------------------------------------------------------------------
40package YAML::Type::undef;
41
42sub yaml_dump {
43 my $self = shift;
44}
45
46sub yaml_load {
47 my $self = shift;
48}
49
50#-------------------------------------------------------------------------------
51package YAML::Type::glob;
52
53sub yaml_dump {
54 my $self = shift;
55 my $ynode = YAML::Node->new({}, '!perl/glob:');
56 for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) {
57 my $value = *{$_[0]}{$type};
58 $value = $$value if $type eq 'SCALAR';
59 if (defined $value) {
60 if ($type eq 'IO') {
61 my @stats = qw(device inode mode links uid gid rdev size
62 atime mtime ctime blksize blocks);
63 undef $value;
64 $value->{stat} = YAML::Node->new({});
65 map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]});
66 $value->{fileno} = fileno(*{$_[0]});
67 {
68 local $^W;
69 $value->{tell} = tell(*{$_[0]});
70 }
71 }
72 $ynode->{$type} = $value;
73 }
74 }
75 return $ynode;
76}
77
78sub yaml_load {
79 my $self = shift;
80 my ($node, $class, $loader) = @_;
81 my ($name, $package);
82 if (defined $node->{NAME}) {
83 $name = $node->{NAME};
84 delete $node->{NAME};
85 }
86 else {
87 $loader->warn('YAML_LOAD_WARN_GLOB_NAME');
88 return undef;
89 }
90 if (defined $node->{PACKAGE}) {
91 $package = $node->{PACKAGE};
92 delete $node->{PACKAGE};
93 }
94 else {
95 $package = 'main';
96 }
973420µs266µs
# spent 42µs (18+24) within YAML::Type::glob::BEGIN@97 which was called: # once (18µs+24µs) by YAML::Loader::BEGIN@7 at line 97
no strict 'refs';
# spent 42µs making 1 call to YAML::Type::glob::BEGIN@97 # spent 24µs making 1 call to strict::unimport
98 if (exists $node->{SCALAR}) {
99 *{"${package}::$name"} = \$node->{SCALAR};
100 delete $node->{SCALAR};
101 }
102 for my $elem (qw(ARRAY HASH CODE IO)) {
103 if (exists $node->{$elem}) {
104 if ($elem eq 'IO') {
105 $loader->warn('YAML_LOAD_WARN_GLOB_IO');
106 delete $node->{IO};
107 next;
108 }
109 *{"${package}::$name"} = $node->{$elem};
110 delete $node->{$elem};
111 }
112 }
113 for my $elem (sort keys %$node) {
114 $loader->warn('YAML_LOAD_WARN_BAD_GLOB_ELEM', $elem);
115 }
116 return *{"${package}::$name"};
117}
118
119#-------------------------------------------------------------------------------
120package YAML::Type::code;
121
1221700nsmy $dummy_warned = 0;
12311µsmy $default = '{ "DUMMY" }';
124
125sub yaml_dump {
126 my $self = shift;
127 my $code;
128 my ($dumpflag, $value) = @_;
129 my ($class, $type) = YAML::Base->node_info($value);
130 my $tag = "!perl/code";
131 $tag .= ":$class" if defined $class;
132 if (not $dumpflag) {
133 $code = $default;
134 }
135 else {
136 bless $value, "CODE" if $class;
13731.53ms252.5ms
# spent 52.5ms (49.4+3.10) within YAML::Type::code::BEGIN@137 which was called: # once (49.4ms+3.10ms) by YAML::Loader::BEGIN@7 at line 137
eval { use B::Deparse };
# spent 52.5ms making 1 call to YAML::Type::code::BEGIN@137 # spent 8µs making 1 call to UNIVERSAL::import
138 return if $@;
139 my $deparse = B::Deparse->new();
140 eval {
141 local $^W = 0;
142 $code = $deparse->coderef2text($value);
143 };
144 if ($@) {
145 warn YAML::YAML_DUMP_WARN_DEPARSE_FAILED() if $^W;
146 $code = $default;
147 }
148 bless $value, $class if $class;
149 chomp $code;
150 $code .= "\n";
151 }
152 $_[2] = $code;
153 YAML::Node->new($_[2], $tag);
154}
155
156sub yaml_load {
157 my $self = shift;
158 my ($node, $class, $loader) = @_;
159 if ($loader->load_code) {
160 my $code = eval "package main; sub $node";
161 if ($@) {
162 $loader->warn('YAML_LOAD_WARN_PARSE_CODE', $@);
163 return sub {};
164 }
165 else {
166 CORE::bless $code, $class if $class;
167 return $code;
168 }
169 }
170 else {
171 return CORE::bless sub {}, $class if $class;
172 return sub {};
173 }
174}
175
176#-------------------------------------------------------------------------------
177package YAML::Type::ref;
178
179sub yaml_dump {
180 my $self = shift;
181 YAML::Node->new({(&YAML::VALUE, ${$_[0]})}, '!perl/ref')
182}
183
184sub yaml_load {
185 my $self = shift;
186 my ($node, $class, $loader) = @_;
187 $loader->die('YAML_LOAD_ERR_NO_DEFAULT_VALUE', 'ptr')
188 unless exists $node->{&YAML::VALUE};
189 return \$node->{&YAML::VALUE};
190}
191
192#-------------------------------------------------------------------------------
193package YAML::Type::regexp;
194
195# XXX Be sure to handle blessed regexps (if possible)
196sub yaml_dump {
197 die "YAML::Type::regexp::yaml_dump not currently implemented";
198}
199
200
# spent 184µs (79+105) within YAML::Type::regexp::BEGIN@200 which was called: # once (79µs+105µs) by YAML::Loader::BEGIN@7 at line 217
use constant _QR_TYPES => {
201 '' => sub { qr{$_[0]} },
202 x => sub { qr{$_[0]}x },
203 i => sub { qr{$_[0]}i },
204 s => sub { qr{$_[0]}s },
205 m => sub { qr{$_[0]}m },
206 ix => sub { qr{$_[0]}ix },
207 sx => sub { qr{$_[0]}sx },
208 mx => sub { qr{$_[0]}mx },
209 si => sub { qr{$_[0]}si },
210 mi => sub { qr{$_[0]}mi },
211 ms => sub { qr{$_[0]}sm },
212 six => sub { qr{$_[0]}six },
213 mix => sub { qr{$_[0]}mix },
214 msx => sub { qr{$_[0]}msx },
215 msi => sub { qr{$_[0]}msi },
216 msix => sub { qr{$_[0]}msix },
2173336µs2289µs};
# spent 184µs making 1 call to YAML::Type::regexp::BEGIN@200 # spent 105µs making 1 call to constant::import
218
219sub yaml_load {
220 my $self = shift;
221 my ($node, $class) = @_;
222 return qr{$node} unless $node =~ /^\(\?([\-xism]*):(.*)\)\z/s;
223 my ($flags, $re) = ($1, $2);
224 $flags =~ s/-.*//;
225 my $sub = _QR_TYPES->{$flags} || sub { qr{$_[0]} };
226 my $qr = &$sub($re);
227 bless $qr, $class if length $class;
228 return $qr;
229}
230
23118µs1;
232
233__END__