line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
############################################################################# |
2
|
|
|
|
|
|
|
## Name: DynaLoader.pm |
3
|
|
|
|
|
|
|
## Purpose: LibZip::DynaLoader |
4
|
|
|
|
|
|
|
## Author: Graciliano M. P. |
5
|
|
|
|
|
|
|
## Modified by: |
6
|
|
|
|
|
|
|
## Created: 2004-06-06 |
7
|
|
|
|
|
|
|
## RCS-ID: |
8
|
|
|
|
|
|
|
## Copyright: (c) 2004 Graciliano M. P. |
9
|
|
|
|
|
|
|
## Licence: This program is free software; you can redistribute it and/or |
10
|
|
|
|
|
|
|
## modify it under the same terms as Perl itself |
11
|
|
|
|
|
|
|
############################################################################# |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package LibZip::DynaLoader ; |
14
|
2
|
|
|
2
|
|
58
|
use 5.006 ; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
101
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '1.04' ; |
17
|
2
|
|
|
2
|
|
11
|
no warnings ; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
140
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
############## |
20
|
|
|
|
|
|
|
# DYNALOADER # |
21
|
|
|
|
|
|
|
############## |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
package DynaLoader; |
24
|
|
|
|
|
|
|
|
25
|
2
|
50
|
|
2
|
|
107
|
BEGIN { $INC{'DynaLoader.pm'} = 1 if !$INC{'DynaLoader.pm'} ;} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
######### |
28
|
|
|
|
|
|
|
# BEGIN # |
29
|
|
|
|
|
|
|
######### |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub BEGIN { |
32
|
2
|
50
|
|
2
|
|
163
|
$sep = $^O eq 'MSWin32' ? '\\' : '/'; |
33
|
2
|
50
|
|
|
|
1811
|
$dlext = $^O eq 'MSWin32' ? 'dll' : 'so'; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub dl_load_flags { 0x00 } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# cut'n' paste from DynaLoader |
39
|
|
|
|
|
|
|
sub bootstrap_inherit { |
40
|
0
|
|
|
0
|
0
|
|
my $module = $_[0]; |
41
|
0
|
|
|
|
|
|
local *isa = *{"$module\::ISA"}; |
|
0
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
local @isa = (@isa, 'DynaLoader'); |
43
|
|
|
|
|
|
|
# Cannot goto due to delocalization. Will report errors on a wrong line? |
44
|
0
|
|
|
|
|
|
bootstrap(@_); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
0
|
|
sub croak { die @_ } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# does not handle .bs files |
51
|
|
|
|
|
|
|
sub bootstrap { |
52
|
0
|
0
|
0
|
0
|
|
|
boot_DynaLoader('DynaLoader') if defined(&boot_DynaLoader) && |
53
|
|
|
|
|
|
|
!defined(&dl_error); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $module = $_[0]; |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
print "DYN>> @_\n" if $LibZip::DEBUG ; |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
LibZip::check_pack_dep("$module.pm") if defined &LibZip::check_pack_dep ; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my @modparts = split(/::/,$module); |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $path = join '/', 'auto', @modparts, $modparts[-1]; $path .= ".$dlext"; |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $file ; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
foreach my $INC_i ( @INC ) { |
68
|
0
|
0
|
|
|
|
|
next if ref $INC_i ; |
69
|
0
|
|
|
|
|
|
my $fl = "$INC_i/$path" ; |
70
|
|
|
|
|
|
|
##print "** $fl [". (-e $fl) ."]\n" ; |
71
|
0
|
0
|
|
|
|
|
if (-e $fl) { $file = $fl ; last ;} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $bootname = "boot_$module"; $bootname =~ s/\W/_/g; |
|
0
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
@dl_require_symbols = ($bootname); |
76
|
0
|
|
|
|
|
|
my $boot_symbol_ref; |
77
|
|
|
|
|
|
|
|
78
|
0
|
0
|
0
|
|
|
|
if (!-e $file || $file eq '') { return( undef ) ;} |
|
0
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
print "DYN FILE>> $file\n" if $LibZip::DEBUG ; |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
my $libref = dl_load_file($file, $module->dl_load_flags) or |
83
|
|
|
|
|
|
|
croak("Can't load '$file' for module $module: ".dl_error()); |
84
|
0
|
|
|
|
|
|
push(@dl_librefs,$libref); # record loaded object |
85
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
if ( defined &dl_undef_symbols ) { |
87
|
0
|
|
|
|
|
|
my @unresolved = dl_undef_symbols(); |
88
|
0
|
0
|
|
|
|
|
if (@unresolved) { |
89
|
0
|
|
|
|
|
|
warn("Undefined symbols present after loading $file: @unresolved\n"); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
0
|
0
|
|
|
|
|
$boot_symbol_ref = dl_find_symbol($libref, $bootname) or |
96
|
|
|
|
|
|
|
croak("Can't find '$bootname' symbol in $file\n"); |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
push(@dl_modules, $module); # record loaded module |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
boot: |
101
|
|
|
|
|
|
|
my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
##print "DYN END! ${module}::bootstrap >> $xs\n" ; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# See comment block above |
106
|
0
|
|
|
|
|
|
&$xs(@args); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
package XSLoader; |
110
|
|
|
|
|
|
|
|
111
|
2
|
50
|
|
2
|
|
374
|
BEGIN { $INC{'XSLoader.pm'} = 1 if !$INC{'XSLoader.pm'} ;} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub load { |
114
|
0
|
|
|
0
|
1
|
|
DynaLoader::bootstrap_inherit(@_); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
####### |
118
|
|
|
|
|
|
|
# END # |
119
|
|
|
|
|
|
|
####### |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|