File | /usr/lib/perl/5.10/XSLoader.pm |
Statements Executed | 1 |
Total Time | 1.98e-05 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
11 | 11 | 11 | 4.61ms | 4.61ms | load | XSLoader::
0 | 0 | 0 | 0s | 0s | bootstrap_inherit | XSLoader::
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | # Generated from XSLoader.pm.PL (resolved %Config::Config value) | |||
2 | ||||
3 | package XSLoader; | |||
4 | ||||
5 | $VERSION = "0.08"; | |||
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 4.61ms within XSLoader::load which was called 11 times, avg 419µs/call:
# once (1.98ms+0s) at line 35 of /usr/lib/perl/5.10/POSIX.pm
# once (347µs+0s) at line 38 of /usr/local/lib/perl/5.10.0/Class/MOP.pm
# once (342µs+0s) at line 10 of /usr/local/lib/perl/5.10.0/Encode.pm
# once (305µs+0s) at line 160 of /usr/lib/perl/5.10/Fcntl.pm
# once (297µs+0s) at line 204 of /usr/local/lib/perl/5.10.0/Variable/Magic.pm
# once (282µs+0s) at line 11 of /usr/lib/perl/5.10/IO.pm
# once (274µs+0s) at line 12 of /usr/lib/perl/5.10/SDBM_File.pm
# once (231µs+0s) at line 27 of /usr/lib/perl/5.10/List/Util.pm
# once (226µs+0s) at line 36 of /usr/lib/perl/5.10/Data/Dumper.pm
# once (224µs+0s) at line 17 of /usr/local/lib/perl/5.10.0/Devel/GlobalDestruction.pm
# once (102µs+0s) at line 21 of /usr/local/lib/perl/5.10.0/Moose/Exporter.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 $b = "$module\::bootstrap"; | |||
31 | goto &$b if defined &$b; | |||
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 | goto retry if not -f $file or -s $bs; | |||
50 | ||||
51 | my $bootname = "boot_$module"; | |||
52 | $bootname =~ s/\W/_/g; | |||
53 | @DynaLoader::dl_require_symbols = ($bootname); | |||
54 | ||||
55 | my $boot_symbol_ref; | |||
56 | ||||
57 | # Many dynamic extension loading problems will appear to come from | |||
58 | # this section of code: XYZ failed at line 123 of DynaLoader.pm. | |||
59 | # Often these errors are actually occurring in the initialisation | |||
60 | # C code of the extension XS file. Perl reports the error as being | |||
61 | # in this perl code simply because this was the last perl code | |||
62 | # it executed. | |||
63 | ||||
64 | my $libref = dl_load_file($file, 0) or do { | |||
65 | require Carp; | |||
66 | Carp::croak("Can't load '$file' for module $module: " . dl_error()); | |||
67 | }; | |||
68 | push(@DynaLoader::dl_librefs,$libref); # record loaded object | |||
69 | ||||
70 | my @unresolved = dl_undef_symbols(); | |||
71 | if (@unresolved) { | |||
72 | require Carp; | |||
73 | Carp::carp("Undefined symbols present after loading $file: @unresolved\n"); | |||
74 | } | |||
75 | ||||
76 | $boot_symbol_ref = dl_find_symbol($libref, $bootname) or do { | |||
77 | require Carp; | |||
78 | Carp::croak("Can't find '$bootname' symbol in $file\n"); | |||
79 | }; | |||
80 | ||||
81 | push(@DynaLoader::dl_modules, $module); # record loaded module | |||
82 | ||||
83 | boot: | |||
84 | my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); | |||
85 | ||||
86 | # See comment block above | |||
87 | push(@DynaLoader::dl_shared_objects, $file); # record files loaded | |||
88 | 1 | 20µs | 20µs | return &$xs(@_); |
89 | ||||
90 | retry: | |||
91 | my $bootstrap_inherit = DynaLoader->can('bootstrap_inherit') || | |||
92 | XSLoader->can('bootstrap_inherit'); | |||
93 | goto &$bootstrap_inherit; | |||
94 | } | |||
95 | ||||
96 | # Versions of DynaLoader prior to 5.6.0 don't have this function. | |||
97 | sub bootstrap_inherit { | |||
98 | package DynaLoader; | |||
99 | ||||
100 | my $module = $_[0]; | |||
101 | local *DynaLoader::isa = *{"$module\::ISA"}; | |||
102 | local @DynaLoader::isa = (@DynaLoader::isa, 'DynaLoader'); | |||
103 | # Cannot goto due to delocalization. Will report errors on a wrong line? | |||
104 | require DynaLoader; | |||
105 | DynaLoader::bootstrap(@_); | |||
106 | } | |||
107 | ||||
108 | 1; | |||
109 | ||||
110 | __END__ | |||
111 |