← Index
Performance Profile   « block view • line view • sub view »
For opac/opac-main.pl
  Run on Thu Jul 17 22:22:09 2008
Reported on Thu Jul 17 22:22:20 2008

File/usr/share/perl/5.8/Exporter.pm
Statements Executed120
Total Time0.000266 seconds

Subroutines — ordered by inclusive time then name
CallsInclusive
Time
Subroutine
70.00039Exporter::import
00Exporter::__ANON__[:63]
00Exporter::as_heavy
00Exporter::export
00Exporter::export_fail
00Exporter::export_ok_tags
00Exporter::export_tags
00Exporter::export_to_level
00Exporter::require_version

LineStmts.Exclusive
Time
Avg.Code
1package Exporter;
2
3require 5.006;
4
5# Be lean.
6#use strict;
7#no strict 'refs';
8
9our $Debug = 0;
10our $ExportLevel = 0;
11our $Verbose ||= 0;
12our $VERSION = '5.58';
13our (%Cache);
14$Carp::Internal{Exporter} = 1;
15
16sub as_heavy {
17 require Exporter::Heavy;
18 # Unfortunately, this does not work if the caller is aliased as *name = \&foo
19 # Thus the need to create a lot of identical subroutines
20 my $c = (caller(1))[3];
21 $c =~ s/.*:://;
22 \&{"Exporter::Heavy::heavy_$c"};
23}
24
25sub export {
26 goto &{as_heavy()};
27}
28
29
# spent 0.00039s within Exporter::import which was called 7 times, avg 0.00006s/call: # 1 times (0.00006s) at line 8 of /usr/share/perl5/CGI/Session/Driver.pm # 1 times (0.00006s) at line 6 of /usr/share/perl5/CGI/Session/ID/md5.pm # 1 times (0.00005s) at line 8 of /usr/share/perl5/CGI/Session/Driver/DBI.pm # 1 times (0.00003s) at line 7 of /usr/share/perl5/CGI/Session/Driver/DBI.pm # 1 times (0.00007s) at line 6 of /usr/share/perl5/CGI/Session/Driver/mysql.pm # 1 times (0.00004s) at line 13 of /usr/lib/perl5/YAML/Syck.pm # 1 times (0.00007s) at line 18 of /usr/share/perl/5.8/CGI/Cookie.pm
sub import {
301050.000232e-06 my $pkg = shift;
31 my $callpkg = caller($ExportLevel);
32
33 if ($pkg eq "Exporter" and @_ and $_[0] eq "import") {
34 *{$callpkg."::import"} = \&import;
35 return;
36 }
37
38 # We *need* to treat @{"$pkg\::EXPORT_FAIL"} since Carp uses it :-(
39 my($exports, $fail) = (\@{"$pkg\::EXPORT"}, \@{"$pkg\::EXPORT_FAIL"});
40 return export $pkg, $callpkg, @_
41 if $Verbose or $Debug or @$fail > 1;
42 my $export_cache = ($Cache{$pkg} ||= {});
43 my $args = @_ or @_ = @$exports;
44
45 local $_;
46 if ($args and not %$export_cache) {
47 s/^&//, $export_cache->{$_} = 1
48 foreach (@$exports, @{"$pkg\::EXPORT_OK"});
49 }
50 my $heavy;
51 # Try very hard not to use {} and hence have to enter scope on the foreach
52 # We bomb out of the loop with last as soon as heavy is set.
53140.000022e-06 if ($args or $fail) {
54 ($heavy = (/\W/ or $args and not exists $export_cache->{$_}
55 or @$fail and $_ eq $fail->[0])) and last
56 foreach (@_);
57 } else {
58 ($heavy = /\W/) and last
59 foreach (@_);
60 }
6110.000010.00001 return export $pkg, $callpkg, ($args ? @_ : ()) if $heavy;
62 local $SIG{__WARN__} =
63 sub {require Carp; &Carp::carp};
64 # shortcut for the common case of no type character
65 *{"$callpkg\::$_"} = \&{"$pkg\::$_"} foreach @_;
66}
67
68# Default methods
69
70sub export_fail {
71 my $self = shift;
72 @_;
73}
74
75# Unfortunately, caller(1)[3] "does not work" if the caller is aliased as
76# *name = \&foo. Thus the need to create a lot of identical subroutines
77# Otherwise we could have aliased them to export().
78
79sub export_to_level {
80 goto &{as_heavy()};
81}
82
83sub export_tags {
84 goto &{as_heavy()};
85}
86
87sub export_ok_tags {
88 goto &{as_heavy()};
89}
90
91sub require_version {
92 goto &{as_heavy()};
93}
94
951;
96__END__
97