Filename | /usr/lib/perl/5.10/XSLoader.pm |
Statements | Executed 0 statements in 36µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
19 | 19 | 19 | 10.2ms | 10.2ms | load | XSLoader::
0 | 0 | 0 | 0s | 0s | bootstrap_inherit | XSLoader::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # Generated from XSLoader.pm.PL (resolved %Config::Config value) | ||||
2 | |||||
3 | package XSLoader; | ||||
4 | |||||
5 | $VERSION = "0.10"; | ||||
6 | |||||
7 | #use strict; | ||||
8 | |||||
9 | # enable debug/trace messages from DynaLoader perl code | ||||
10 | # $dl_debug = $ENV{PERL_DL_DEBUG} || 0 unless defined $dl_debug; | ||||
11 | |||||
12 | my $dl_dlext = 'so'; | ||||
13 | |||||
14 | package DynaLoader; | ||||
15 | |||||
16 | # No prizes for guessing why we don't say 'bootstrap DynaLoader;' here. | ||||
17 | # NOTE: All dl_*.xs (including dl_none.xs) define a dl_error() XSUB | ||||
18 | boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && | ||||
19 | !defined(&dl_error); | ||||
20 | package XSLoader; | ||||
21 | |||||
22 | # spent 10.2ms (10.2+59µs) within XSLoader::load which was called 19 times, avg 539µs/call:
# once (3.43ms+0s) by C4::Context::BEGIN@4 at line 10 of Net/Z3950/ZOOM.pm
# once (1.26ms+0s) by JSON::PP::BEGIN@11 at line 318 of B.pm
# once (869µs+0s) by C4::Context::BEGIN@106 at line 36 of POSIX.pm
# once (506µs+59µs) by MARC::File::Encode::BEGIN@22 at line 10 of Encode.pm
# once (361µs+0s) by IO::Handle::BEGIN@9 at line 11 of IO.pm
# once (351µs+0s) by Params::Validate::BEGIN@5 at line 7 of Params/ValidateXS.pm
# once (332µs+0s) by MARC::Charset::Table::BEGIN@37 at line 84 of GDBM_File.pm
# once (305µs+0s) by Params::Check::BEGIN@8 at line 36 of Data/Dumper.pm
# once (289µs+0s) by Mail::Sendmail::BEGIN@54 at line 240 of Socket.pm
# once (280µs+0s) by Fcntl::BEGIN@159 at line 160 of Fcntl.pm
# once (270µs+0s) by YAML::Syck::BEGIN@15 at line 26 of YAML/Syck.pm
# once (269µs+0s) by Readonly::BEGIN@2 at line 25 of Readonly/XS.pm
# once (267µs+0s) by C4::Auth::BEGIN@22 at line 24 of Digest/MD5.pm
# once (253µs+0s) by File::Path::BEGIN@6 at line 80 of Cwd.pm
# once (251µs+0s) by C4::Context::BEGIN@101 at line 27 of List/Util.pm
# once (247µs+0s) by Modern::Perl::BEGIN@20 at line 41 of mro.pm
# once (240µs+0s) by C4::Letters::BEGIN@23 at line 13 of MIME/Base64.pm
# once (228µs+0s) by DateTime::BEGIN@14 at line 20 of DateTime.pm
# once (180µs+0s) by Sys::Hostname::BEGIN@17 at line 23 of Sys/Hostname.pm | ||||
23 | package DynaLoader; | ||||
24 | |||||
25 | die q{XSLoader::load('Your::Module', $Your::Module::VERSION)} unless @_; | ||||
26 | |||||
27 | my($module) = $_[0]; | ||||
28 | |||||
29 | # work with static linking too | ||||
30 | my $boots = "$module\::bootstrap"; | ||||
31 | goto &$boots if defined &$boots; | ||||
32 | |||||
33 | goto retry unless $module and defined &dl_load_file; | ||||
34 | |||||
35 | my @modparts = split(/::/,$module); | ||||
36 | my $modfname = $modparts[-1]; | ||||
37 | |||||
38 | my $modpname = join('/',@modparts); | ||||
39 | my $modlibname = (caller())[1]; | ||||
40 | my $c = @modparts; | ||||
41 | $modlibname =~ s,[\\/][^\\/]+$,, while $c--; # Q&D basename | ||||
42 | my $file = "$modlibname/auto/$modpname/$modfname.$dl_dlext"; | ||||
43 | |||||
44 | # print STDERR "XSLoader::load for $module ($file)\n" if $dl_debug; | ||||
45 | |||||
46 | my $bs = $file; | ||||
47 | $bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library | ||||
48 | |||||
49 | if (-s $bs) { # only read file if it's not empty | ||||
50 | # print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug; | ||||
51 | eval { do $bs; }; | ||||
52 | warn "$bs: $@\n" if $@; | ||||
53 | } | ||||
54 | |||||
55 | goto retry if not -f $file or -s $bs; | ||||
56 | |||||
57 | my $bootname = "boot_$module"; | ||||
58 | $bootname =~ s/\W/_/g; | ||||
59 | @DynaLoader::dl_require_symbols = ($bootname); | ||||
60 | |||||
61 | my $boot_symbol_ref; | ||||
62 | |||||
63 | # Many dynamic extension loading problems will appear to come from | ||||
64 | # this section of code: XYZ failed at line 123 of DynaLoader.pm. | ||||
65 | # Often these errors are actually occurring in the initialisation | ||||
66 | # C code of the extension XS file. Perl reports the error as being | ||||
67 | # in this perl code simply because this was the last perl code | ||||
68 | # it executed. | ||||
69 | |||||
70 | my $libref = dl_load_file($file, 0) or do { | ||||
71 | require Carp; | ||||
72 | Carp::croak("Can't load '$file' for module $module: " . dl_error()); | ||||
73 | }; | ||||
74 | push(@DynaLoader::dl_librefs,$libref); # record loaded object | ||||
75 | |||||
76 | my @unresolved = dl_undef_symbols(); | ||||
77 | if (@unresolved) { | ||||
78 | require Carp; | ||||
79 | Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); | ||||
80 | } | ||||
81 | |||||
82 | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or do { | ||||
83 | require Carp; | ||||
84 | Carp::croak("Can't find '$bootname' symbol in $file\n"); | ||||
85 | }; | ||||
86 | |||||
87 | push(@DynaLoader::dl_modules, $module); # record loaded module | ||||
88 | |||||
89 | boot: | ||||
90 | my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file); | ||||
91 | |||||
92 | # See comment block above | ||||
93 | push(@DynaLoader::dl_shared_objects, $file); # record files loaded | ||||
94 | 1 | 36µs | 4 | 59µs | return &$xs(@_); # spent 59µs making 4 calls to Encode::define_encoding, avg 15µs/call |
95 | |||||
96 | retry: | ||||
97 | my $bootstrap_inherit = DynaLoader->can('bootstrap_inherit') || | ||||
98 | XSLoader->can('bootstrap_inherit'); | ||||
99 | goto &$bootstrap_inherit; | ||||
100 | } | ||||
101 | |||||
102 | # Versions of DynaLoader prior to 5.6.0 don't have this function. | ||||
103 | sub bootstrap_inherit { | ||||
104 | package DynaLoader; | ||||
105 | |||||
106 | my $module = $_[0]; | ||||
107 | local *DynaLoader::isa = *{"$module\::ISA"}; | ||||
108 | local @DynaLoader::isa = (@DynaLoader::isa, 'DynaLoader'); | ||||
109 | # Cannot goto due to delocalization. Will report errors on a wrong line? | ||||
110 | require DynaLoader; | ||||
111 | DynaLoader::bootstrap(@_); | ||||
112 | } | ||||
113 | |||||
114 | 1; | ||||
115 | |||||
116 | __END__ | ||||
117 |