line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Inline; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
require 5.006; |
5
|
|
|
|
|
|
|
$Inline::VERSION = '0.54_02'; |
6
|
|
|
|
|
|
|
$Inline::VERSION = eval $Inline::VERSION; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
846
|
use AutoLoader 'AUTOLOAD'; |
|
1
|
|
|
|
|
1344
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
368
|
use Inline::denter; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
10
|
1
|
|
|
1
|
|
6
|
use Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
11
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
47
|
|
12
|
1
|
|
|
1
|
|
4
|
use Cwd qw(abs_path cwd); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
52
|
|
13
|
1
|
|
|
1
|
|
4
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
14
|
1
|
|
|
1
|
|
5
|
use File::Spec::Unix; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
15
|
1
|
|
|
1
|
|
6
|
use Fcntl qw(LOCK_EX LOCK_UN); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1907
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my %CONFIG = (); |
18
|
|
|
|
|
|
|
my @DATA_OBJS = (); |
19
|
|
|
|
|
|
|
my $INIT = 0; |
20
|
|
|
|
|
|
|
my $version_requested = 0; |
21
|
|
|
|
|
|
|
my $version_printed = 0; |
22
|
|
|
|
|
|
|
my $untaint = 0; |
23
|
|
|
|
|
|
|
my $safemode = 0; |
24
|
|
|
|
|
|
|
$Inline::languages = undef; #needs to be global for AutoLoaded error messages |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $did = '_Inline'; # Default Inline Directory |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# This is the config file written by create_config_file(). |
29
|
|
|
|
|
|
|
our $configuration_file = 'config-' . $Config::Config{'archname'} . '-' . $]; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my %shortcuts = |
32
|
|
|
|
|
|
|
( |
33
|
|
|
|
|
|
|
NOCLEAN => [CLEAN_AFTER_BUILD => 0], |
34
|
|
|
|
|
|
|
CLEAN => [CLEAN_BUILD_AREA => 1], |
35
|
|
|
|
|
|
|
FORCE => [FORCE_BUILD => 1], |
36
|
|
|
|
|
|
|
INFO => [PRINT_INFO => 1], |
37
|
|
|
|
|
|
|
VERSION => [PRINT_VERSION => 1], |
38
|
|
|
|
|
|
|
REPORTBUG => [REPORTBUG => 1], |
39
|
|
|
|
|
|
|
UNTAINT => [UNTAINT => 1], |
40
|
|
|
|
|
|
|
SAFE => [SAFEMODE => 1], |
41
|
|
|
|
|
|
|
UNSAFE => [SAFEMODE => 0], |
42
|
|
|
|
|
|
|
GLOBAL => [GLOBAL_LOAD => 1], |
43
|
|
|
|
|
|
|
NOISY => [BUILD_NOISY => 1], |
44
|
|
|
|
|
|
|
TIMERS => [BUILD_TIMERS => 1], |
45
|
|
|
|
|
|
|
NOWARN => [WARNINGS => 0], |
46
|
|
|
|
|
|
|
_INSTALL_ => [_INSTALL_ => 1], |
47
|
|
|
|
|
|
|
SITE_INSTALL => undef, # No longer supported. |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $default_config = |
51
|
|
|
|
|
|
|
{ |
52
|
|
|
|
|
|
|
NAME => '', |
53
|
|
|
|
|
|
|
AUTONAME => -1, |
54
|
|
|
|
|
|
|
VERSION => '', |
55
|
|
|
|
|
|
|
DIRECTORY => '', |
56
|
|
|
|
|
|
|
WITH => [], |
57
|
|
|
|
|
|
|
USING => [], |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
CLEAN_AFTER_BUILD => 1, |
60
|
|
|
|
|
|
|
CLEAN_BUILD_AREA => 0, |
61
|
|
|
|
|
|
|
FORCE_BUILD => 0, |
62
|
|
|
|
|
|
|
PRINT_INFO => 0, |
63
|
|
|
|
|
|
|
PRINT_VERSION => 0, |
64
|
|
|
|
|
|
|
REPORTBUG => 0, |
65
|
|
|
|
|
|
|
UNTAINT => 0, |
66
|
|
|
|
|
|
|
NO_UNTAINT_WARN => 0, |
67
|
|
|
|
|
|
|
REWRITE_CONFIG_FILE => 0, |
68
|
|
|
|
|
|
|
SAFEMODE => -1, |
69
|
|
|
|
|
|
|
GLOBAL_LOAD => 0, |
70
|
|
|
|
|
|
|
BUILD_NOISY => 0, |
71
|
|
|
|
|
|
|
BUILD_TIMERS => 0, |
72
|
|
|
|
|
|
|
WARNINGS => 1, |
73
|
|
|
|
|
|
|
_INSTALL_ => 0, |
74
|
|
|
|
|
|
|
_TESTING => 0, |
75
|
|
|
|
|
|
|
}; |
76
|
|
|
|
|
|
|
|
77
|
11
|
|
|
11
|
1
|
2474
|
sub UNTAINT {$untaint} |
78
|
1
|
|
|
1
|
1
|
13
|
sub SAFEMODE {$safemode} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#============================================================================== |
81
|
|
|
|
|
|
|
# This is where everything starts. |
82
|
|
|
|
|
|
|
#============================================================================== |
83
|
|
|
|
|
|
|
sub import { |
84
|
2
|
|
|
2
|
|
18
|
local ($/, $") = ("\n", ' '); local ($\, $,); |
|
2
|
|
|
|
|
6
|
|
85
|
|
|
|
|
|
|
|
86
|
2
|
|
|
|
|
2
|
my $o; |
87
|
2
|
|
|
|
|
9
|
my ($pkg, $script) = caller; |
88
|
|
|
|
|
|
|
# Not sure what this is for. Let's see what breaks. |
89
|
|
|
|
|
|
|
# $pkg =~ s/^.*[\/\\]//; |
90
|
2
|
|
|
|
|
79
|
my $class = shift; |
91
|
2
|
50
|
|
|
|
8
|
if ($class ne 'Inline') { |
92
|
0
|
0
|
|
|
|
0
|
croak M01_usage_use($class) if $class =~ /^Inline::/; |
93
|
0
|
|
|
|
|
0
|
croak M02_usage(); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
2
|
|
66
|
|
|
12
|
$CONFIG{$pkg}{template} ||= $default_config; |
97
|
|
|
|
|
|
|
|
98
|
2
|
50
|
|
|
|
5
|
return unless @_; |
99
|
2
|
50
|
|
|
|
5
|
&create_config_file(), return 1 if $_[0] eq '_CONFIG_'; |
100
|
2
|
50
|
|
|
|
10
|
goto &maker_utils if $_[0] =~ /^(install|makedist|makeppd)$/i; |
101
|
|
|
|
|
|
|
|
102
|
2
|
|
|
|
|
3
|
my $control = shift; |
103
|
|
|
|
|
|
|
|
104
|
2
|
50
|
33
|
|
|
20
|
if ($control eq 'with') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
105
|
0
|
|
|
|
|
0
|
return handle_with($pkg, @_); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
elsif ($control eq 'Config') { |
108
|
1
|
|
|
|
|
4
|
return handle_global_config($pkg, @_); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
elsif (exists $shortcuts{uc($control)}) { |
111
|
0
|
|
|
|
|
0
|
handle_shortcuts($pkg, $control, @_); |
112
|
0
|
|
|
|
|
0
|
$version_requested = $CONFIG{$pkg}{template}{PRINT_VERSION}; |
113
|
0
|
|
|
|
|
0
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
elsif ($control =~ /^\S+$/ and $control !~ /\n/) { |
116
|
1
|
|
|
|
|
3
|
my $language_id = $control; |
117
|
1
|
|
50
|
|
|
5
|
my $option = shift || ''; |
118
|
1
|
|
|
|
|
2
|
my @config = @_; |
119
|
1
|
|
|
|
|
2
|
my $next = 0; |
120
|
1
|
|
|
|
|
4
|
for (@config) { |
121
|
0
|
0
|
|
|
|
0
|
next if $next++ % 2; |
122
|
0
|
0
|
|
|
|
0
|
croak M02_usage() if /[\s\n]/; |
123
|
|
|
|
|
|
|
} |
124
|
1
|
|
|
|
|
2
|
$o = bless {}, $class; |
125
|
1
|
|
|
|
|
7
|
$o->{INLINE}{version} = $Inline::VERSION; |
126
|
1
|
|
|
|
|
4
|
$o->{API}{pkg} = $pkg; |
127
|
1
|
|
|
|
|
3
|
$o->{API}{script} = $script; |
128
|
1
|
|
|
|
|
1
|
$o->{API}{language_id} = $language_id; |
129
|
1
|
50
|
33
|
|
|
19
|
if ($option =~ /^(FILE|BELOW)$/ or |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
130
|
|
|
|
|
|
|
not $option and |
131
|
|
|
|
|
|
|
defined $INC{File::Spec::Unix->catfile('Inline','Files.pm')} and |
132
|
|
|
|
|
|
|
Inline::Files::get_filename($pkg) |
133
|
|
|
|
|
|
|
) { |
134
|
0
|
|
|
|
|
0
|
$o->read_inline_file; |
135
|
0
|
|
|
|
|
0
|
$o->{CONFIG} = handle_language_config(@config); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
elsif ($option eq 'DATA' or not $option) { |
138
|
0
|
|
|
|
|
0
|
$o->{CONFIG} = handle_language_config(@config); |
139
|
0
|
|
|
|
|
0
|
push @DATA_OBJS, $o; |
140
|
0
|
|
|
|
|
0
|
return; |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
elsif ($option eq 'Config') { |
143
|
0
|
|
|
|
|
0
|
$CONFIG{$pkg}{$language_id} = handle_language_config(@config); |
144
|
0
|
|
|
|
|
0
|
return; |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
else { |
147
|
1
|
|
|
|
|
11
|
$o->receive_code($option); |
148
|
1
|
|
|
|
|
896
|
$o->{CONFIG} = handle_language_config(@config); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
else { |
152
|
0
|
|
|
|
|
0
|
croak M02_usage(); |
153
|
|
|
|
|
|
|
} |
154
|
1
|
|
|
|
|
5
|
$o->glue; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
#============================================================================== |
158
|
|
|
|
|
|
|
# Run time version of import (public method) |
159
|
|
|
|
|
|
|
#============================================================================== |
160
|
|
|
|
|
|
|
sub bind { |
161
|
0
|
|
|
0
|
1
|
0
|
local ($/, $") = ("\n", ' '); local ($\, $,); |
|
0
|
|
|
|
|
0
|
|
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
0
|
my ($code, @config); |
164
|
0
|
|
|
|
|
0
|
my $o; |
165
|
0
|
|
|
|
|
0
|
my ($pkg, $script) = caller; |
166
|
0
|
|
|
|
|
0
|
my $class = shift; |
167
|
0
|
0
|
|
|
|
0
|
croak M03_usage_bind() unless $class eq 'Inline'; |
168
|
|
|
|
|
|
|
|
169
|
0
|
|
0
|
|
|
0
|
$CONFIG{$pkg}{template} ||= $default_config; |
170
|
|
|
|
|
|
|
|
171
|
0
|
0
|
|
|
|
0
|
my $language_id = shift or croak M03_usage_bind(); |
172
|
0
|
0
|
0
|
|
|
0
|
croak M03_usage_bind() |
173
|
|
|
|
|
|
|
unless ($language_id =~ /^\S+$/ and $language_id !~ /\n/); |
174
|
0
|
0
|
|
|
|
0
|
$code = shift or croak M03_usage_bind(); |
175
|
0
|
|
|
|
|
0
|
@config = @_; |
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
0
|
my $next = 0; |
178
|
0
|
|
|
|
|
0
|
for (@config) { |
179
|
0
|
0
|
|
|
|
0
|
next if $next++ % 2; |
180
|
0
|
0
|
|
|
|
0
|
croak M03_usage_bind() if /[\s\n]/; |
181
|
|
|
|
|
|
|
} |
182
|
0
|
|
|
|
|
0
|
$o = bless {}, $class; |
183
|
0
|
|
|
|
|
0
|
$o->{INLINE}{version} = $Inline::VERSION; |
184
|
0
|
|
|
|
|
0
|
$o->{API}{pkg} = $pkg; |
185
|
0
|
|
|
|
|
0
|
$o->{API}{script} = $script; |
186
|
0
|
|
|
|
|
0
|
$o->{API}{language_id} = $language_id; |
187
|
0
|
|
|
|
|
0
|
$o->receive_code($code); |
188
|
0
|
|
|
|
|
0
|
$o->{CONFIG} = handle_language_config(@config); |
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
0
|
$o->glue; |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
#============================================================================== |
194
|
|
|
|
|
|
|
# Process delayed objects that don't have source code yet. |
195
|
|
|
|
|
|
|
#============================================================================== |
196
|
|
|
|
|
|
|
# This code is an ugly hack because of the fact that you can't use an |
197
|
|
|
|
|
|
|
# INIT block at "run-time proper". So we kill the warning and tell users |
198
|
|
|
|
|
|
|
# to use an Inline->init() call if they run into problems. (rare) |
199
|
|
|
|
|
|
|
|
200
|
1
|
|
|
1
|
|
8
|
eval <
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
73
|
|
201
|
|
|
|
|
|
|
no warnings; |
202
|
|
|
|
|
|
|
\$INIT = \$INIT; # Needed by Sarathy's patch. |
203
|
|
|
|
|
|
|
sub INIT { |
204
|
|
|
|
|
|
|
\$INIT++; |
205
|
|
|
|
|
|
|
&init; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
END |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub init { |
210
|
0
|
|
|
0
|
0
|
0
|
local ($/, $") = ("\n", ' '); local ($\, $,); |
|
0
|
|
|
|
|
0
|
|
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
0
|
while (my $o = shift(@DATA_OBJS)) { |
213
|
0
|
|
|
|
|
0
|
$o->read_DATA; |
214
|
0
|
|
|
|
|
0
|
$o->glue; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub END { |
219
|
1
|
50
|
|
1
|
|
1197
|
warn M51_unused_DATA() if @DATA_OBJS; |
220
|
1
|
50
|
33
|
|
|
13
|
print_version() if $version_requested && not $version_printed; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
#============================================================================== |
224
|
|
|
|
|
|
|
# Print a small report about the version of Inline |
225
|
|
|
|
|
|
|
#============================================================================== |
226
|
|
|
|
|
|
|
sub print_version { |
227
|
0
|
0
|
|
0
|
0
|
0
|
return if $version_printed++; |
228
|
0
|
|
|
|
|
0
|
print STDERR <
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
You are using Inline.pm version $Inline::VERSION |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
END |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
#============================================================================== |
236
|
|
|
|
|
|
|
# Compile the source if needed and then dynaload the object |
237
|
|
|
|
|
|
|
#============================================================================== |
238
|
|
|
|
|
|
|
sub glue { |
239
|
1
|
|
|
1
|
0
|
2
|
my $o = shift; |
240
|
1
|
|
|
|
|
3
|
my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)}; |
|
1
|
|
|
|
|
5
|
|
241
|
1
|
|
|
|
|
9
|
my @config = (%{$CONFIG{$pkg}{template}}, |
242
|
1
|
50
|
|
|
|
9
|
%{$CONFIG{$pkg}{$language_id} || {}}, |
243
|
1
|
50
|
|
|
|
2
|
%{$o->{CONFIG} || {}}, |
|
1
|
|
|
|
|
12
|
|
244
|
|
|
|
|
|
|
); |
245
|
1
|
|
|
|
|
9
|
@config = $o->check_config(@config); |
246
|
1
|
|
|
|
|
20
|
$o->fold_options; |
247
|
|
|
|
|
|
|
|
248
|
1
|
|
|
|
|
4
|
$o->check_installed; |
249
|
1
|
50
|
|
|
|
2
|
$o->env_untaint if UNTAINT; |
250
|
1
|
50
|
|
|
|
1181
|
if (not $o->{INLINE}{object_ready}) { |
251
|
1
|
|
|
|
|
11
|
$o->check_config_file; # Final DIRECTORY set here. |
252
|
1
|
|
|
|
|
68
|
push @config, $o->with_configs; |
253
|
1
|
|
|
|
|
588
|
my $language = $o->{API}{language}; |
254
|
1
|
50
|
|
|
|
9
|
croak M04_error_nocode($language_id) unless $o->{API}{code}; |
255
|
1
|
|
|
|
|
11
|
$o->check_module; |
256
|
|
|
|
|
|
|
} |
257
|
1
|
50
|
|
|
|
917
|
$o->env_untaint if UNTAINT; |
258
|
1
|
50
|
|
|
|
283
|
$o->obj_untaint if UNTAINT; |
259
|
1
|
50
|
|
|
|
684
|
print_version() if $version_requested; |
260
|
1
|
50
|
|
|
|
5
|
$o->reportbug() if $o->{CONFIG}{REPORTBUG}; |
261
|
1
|
50
|
33
|
|
|
8
|
if (not $o->{INLINE}{object_ready} |
262
|
|
|
|
|
|
|
or $o->{CONFIG}{PRINT_INFO} |
263
|
|
|
|
|
|
|
) { |
264
|
1
|
|
|
|
|
86
|
eval "require $o->{INLINE}{ILSM_module}"; |
265
|
1
|
50
|
|
|
|
9
|
croak M05_error_eval('glue', $@) if $@; |
266
|
1
|
|
|
|
|
6
|
$o->push_overrides; |
267
|
1
|
|
|
|
|
4
|
bless $o, $o->{INLINE}{ILSM_module}; |
268
|
1
|
|
|
|
|
22
|
$o->validate(@config); |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
else { |
271
|
0
|
|
|
|
|
0
|
$o->{CONFIG} = {(%{$o->{CONFIG}}, @config)}; |
|
0
|
|
|
|
|
0
|
|
272
|
|
|
|
|
|
|
} |
273
|
1
|
50
|
|
|
|
4
|
$o->print_info if $o->{CONFIG}{PRINT_INFO}; |
274
|
1
|
50
|
33
|
|
|
9
|
unless ($o->{INLINE}{object_ready} or |
275
|
|
|
|
|
|
|
not length $o->{INLINE}{ILSM_suffix}) { |
276
|
1
|
|
|
|
|
6
|
$o->build(); |
277
|
0
|
0
|
|
|
|
0
|
$o->write_inl_file() unless $o->{CONFIG}{_INSTALL_}; |
278
|
|
|
|
|
|
|
} |
279
|
0
|
0
|
0
|
|
|
0
|
if ($o->{INLINE}{ILSM_suffix} ne 'so' and |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
280
|
|
|
|
|
|
|
$o->{INLINE}{ILSM_suffix} ne 'dll' and |
281
|
|
|
|
|
|
|
$o->{INLINE}{ILSM_suffix} ne 'bundle' and |
282
|
|
|
|
|
|
|
$o->{INLINE}{ILSM_suffix} ne 'sl' and |
283
|
|
|
|
|
|
|
ref($o) eq 'Inline' |
284
|
|
|
|
|
|
|
) { |
285
|
0
|
|
|
|
|
0
|
eval "require $o->{INLINE}{ILSM_module}"; |
286
|
0
|
0
|
|
|
|
0
|
croak M05_error_eval('glue', $@) if $@; |
287
|
0
|
|
|
|
|
0
|
$o->push_overrides; |
288
|
0
|
|
|
|
|
0
|
bless $o, $o->{INLINE}{ILSM_module}; |
289
|
0
|
|
|
|
|
0
|
$o->validate(@config); |
290
|
|
|
|
|
|
|
} |
291
|
0
|
|
|
|
|
0
|
$o->load; |
292
|
0
|
|
|
|
|
0
|
$o->pop_overrides; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
#============================================================================== |
296
|
|
|
|
|
|
|
# Set up the USING overrides |
297
|
|
|
|
|
|
|
#============================================================================== |
298
|
|
|
|
|
|
|
sub push_overrides { |
299
|
1
|
|
|
1
|
0
|
3
|
my ($o) = @_; |
300
|
1
|
|
|
|
|
5
|
my ($language_id) = $o->{API}{language_id}; |
301
|
1
|
|
|
|
|
3
|
my ($ilsm) = $o->{INLINE}{ILSM_module}; |
302
|
1
|
|
|
|
|
3
|
for (@{$o->{CONFIG}{USING}}) { |
|
1
|
|
|
|
|
6
|
|
303
|
0
|
0
|
|
|
|
0
|
my $using_module = /^::/ |
|
|
0
|
|
|
|
|
|
304
|
|
|
|
|
|
|
? "Inline::$language_id$_" |
305
|
|
|
|
|
|
|
: /::/ |
306
|
|
|
|
|
|
|
? $_ |
307
|
|
|
|
|
|
|
: "Inline::${language_id}::$_"; |
308
|
0
|
|
|
|
|
0
|
eval "require $using_module"; |
309
|
0
|
0
|
|
|
|
0
|
croak "Invalid module '$using_module' in USING list:\n$@" if $@; |
310
|
0
|
|
|
|
|
0
|
my $register; |
311
|
0
|
|
|
|
|
0
|
eval "\$register = $using_module->register"; |
312
|
0
|
0
|
|
|
|
0
|
croak "Invalid module '$using_module' in USING list:\n$@" if $@; |
313
|
0
|
|
|
|
|
0
|
for my $override (@{$register->{overrides}}) { |
|
0
|
|
|
|
|
0
|
|
314
|
1
|
|
|
1
|
|
12
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
315
|
0
|
0
|
|
|
|
0
|
next if defined $o->{OVERRIDDEN}{$ilsm . "::$override"}; |
316
|
|
|
|
|
|
|
$o->{OVERRIDDEN}{$ilsm . "::$override"} = |
317
|
0
|
|
|
|
|
0
|
\&{$ilsm . "::$override"}; |
|
0
|
|
|
|
|
0
|
|
318
|
|
|
|
|
|
|
{ |
319
|
1
|
|
|
1
|
|
8
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
345
|
|
|
0
|
|
|
|
|
0
|
|
320
|
0
|
|
|
|
|
0
|
*{$ilsm . "::$override"} = |
321
|
0
|
|
|
|
|
0
|
\&{$using_module . "::$override"}; |
|
0
|
|
|
|
|
0
|
|
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
#============================================================================== |
328
|
|
|
|
|
|
|
# Restore the modules original methods |
329
|
|
|
|
|
|
|
#============================================================================== |
330
|
|
|
|
|
|
|
sub pop_overrides { |
331
|
0
|
0
|
|
0
|
0
|
0
|
my $nowarn = $] >= 5.006 ? "no warnings 'redefine';" : ''; |
332
|
0
|
|
|
|
|
0
|
eval ($nowarn . |
333
|
|
|
|
|
|
|
'my ($o) = @_; |
334
|
|
|
|
|
|
|
for my $override (keys %{$o->{OVERRIDDEN}}) { |
335
|
|
|
|
|
|
|
no strict "refs"; |
336
|
|
|
|
|
|
|
*{$override} = $o->{OVERRIDDEN}{$override}; |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
delete $o->{OVERRIDDEN};') |
339
|
|
|
|
|
|
|
} |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
#============================================================================== |
342
|
|
|
|
|
|
|
# Get source from the DATA filehandle |
343
|
|
|
|
|
|
|
#============================================================================== |
344
|
|
|
|
|
|
|
my (%DATA, %DATA_read); |
345
|
|
|
|
|
|
|
sub read_DATA { |
346
|
0
|
|
|
0
|
0
|
0
|
require Socket; |
347
|
0
|
|
|
|
|
0
|
my ($marker, $marker_tag); |
348
|
0
|
|
|
|
|
0
|
my $o = shift; |
349
|
0
|
|
|
|
|
0
|
my ($pkg, $language_id) = @{$o->{API}}{qw(pkg language_id)}; |
|
0
|
|
|
|
|
0
|
|
350
|
0
|
0
|
|
|
|
0
|
unless ($DATA_read{$pkg}++) { |
351
|
1
|
|
|
1
|
|
13
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2498
|
|
352
|
0
|
|
|
|
|
0
|
*Inline::DATA = *{$pkg . '::DATA'}; |
|
0
|
|
|
|
|
0
|
|
353
|
0
|
|
|
|
|
0
|
local ($/); |
354
|
0
|
|
|
|
|
0
|
my ($CR, $LF) = (&Socket::CR, &Socket::LF); |
355
|
0
|
|
|
|
|
0
|
(my $data = ) =~ s/$CR?$LF/\n/g; |
356
|
0
|
|
|
|
|
0
|
@{$DATA{$pkg}} = split /(?m)^[ \t]{0,}(__\S+?__\n)/, $data; |
|
0
|
|
|
|
|
0
|
|
357
|
0
|
0
|
0
|
|
|
0
|
shift @{$DATA{$pkg}} unless ($ {$DATA{$pkg}}[0] || '') =~ /__\S+?__\n/; |
|
0
|
|
|
|
|
0
|
|
358
|
|
|
|
|
|
|
} |
359
|
0
|
|
|
|
|
0
|
($marker, $o->{API}{code}) = splice @{$DATA{$pkg}}, 0, 2; |
|
0
|
|
|
|
|
0
|
|
360
|
0
|
0
|
|
|
|
0
|
croak M08_no_DATA_source_code($language_id) |
361
|
|
|
|
|
|
|
unless defined $marker; |
362
|
0
|
|
|
|
|
0
|
($marker_tag = $marker) =~ s/__(\S+?)__\n/$1/; |
363
|
0
|
0
|
|
|
|
0
|
croak M09_marker_mismatch($marker, $language_id) |
364
|
|
|
|
|
|
|
unless $marker_tag eq $language_id; |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
#============================================================================== |
368
|
|
|
|
|
|
|
# Validate and store the non language-specific config options |
369
|
|
|
|
|
|
|
#============================================================================== |
370
|
|
|
|
|
|
|
sub check_config { |
371
|
1
|
|
|
1
|
0
|
1
|
my $o = shift; |
372
|
1
|
|
|
|
|
2
|
my @others; |
373
|
1
|
|
|
|
|
4
|
while (@_) { |
374
|
22
|
|
|
|
|
33
|
my ($key, $value) = (shift, shift); |
375
|
22
|
50
|
|
|
|
37
|
if (defined $default_config->{$key}) { |
376
|
22
|
100
|
|
|
|
64
|
if ($key =~ /^(WITH|USING)$/) { |
377
|
2
|
50
|
33
|
|
|
16
|
croak M10_usage_WITH_USING() |
378
|
|
|
|
|
|
|
if (ref $value and ref $value ne 'ARRAY'); |
379
|
2
|
50
|
|
|
|
5
|
$value = [$value] unless ref $value; |
380
|
2
|
|
|
|
|
5
|
$o->{CONFIG}{$key} = $value; |
381
|
2
|
|
|
|
|
6
|
next; |
382
|
|
|
|
|
|
|
} |
383
|
20
|
100
|
|
|
|
64
|
$o->{CONFIG}{$key} = $value, next if not $value; |
384
|
6
|
100
|
|
|
|
24
|
if ($key eq 'DIRECTORY') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
385
|
1
|
50
|
|
|
|
18
|
croak M11_usage_DIRECTORY($value) unless (-d $value); |
386
|
1
|
|
|
|
|
27
|
$value = abs_path($value); |
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
elsif ($key eq 'NAME') { |
389
|
0
|
0
|
|
|
|
0
|
croak M12_usage_NAME($value) |
390
|
|
|
|
|
|
|
unless $value =~ /^[a-zA-Z_](\w|::)*$/; |
391
|
|
|
|
|
|
|
} |
392
|
|
|
|
|
|
|
elsif ($key eq 'VERSION') { |
393
|
0
|
0
|
|
|
|
0
|
croak M13_usage_VERSION($value) unless $value =~ /^\d\.\d\d*$/; |
394
|
|
|
|
|
|
|
} |
395
|
6
|
|
|
|
|
24
|
$o->{CONFIG}{$key} = $value; |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
else { |
398
|
0
|
|
|
|
|
0
|
push @others, $key, $value; |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
} |
401
|
1
|
|
|
|
|
6
|
return (@others); |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
#============================================================================== |
405
|
|
|
|
|
|
|
# Set option defaults based on current option settings. |
406
|
|
|
|
|
|
|
#============================================================================== |
407
|
|
|
|
|
|
|
sub fold_options { |
408
|
1
|
|
|
1
|
0
|
3
|
my $o = shift; |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
# The following small section of code seems, to me, to be unnecessary - which is the |
411
|
|
|
|
|
|
|
# reason that I've commented it out. I've left it here (including its associated comments) |
412
|
|
|
|
|
|
|
# in case it later becomes evident that there *is* good reason to include it. --sisyphus |
413
|
|
|
|
|
|
|
# |
414
|
|
|
|
|
|
|
## This bit tries to enable UNTAINT automatically if required when running the test suite. |
415
|
|
|
|
|
|
|
# my $env_ha = $ENV{HARNESS_ACTIVE} || 0 ; |
416
|
|
|
|
|
|
|
# my ($harness_active) = $env_ha =~ /(.*)/ ; |
417
|
|
|
|
|
|
|
# if (($harness_active)&&(! $o->{CONFIG}{UNTAINT})){ |
418
|
|
|
|
|
|
|
# eval { |
419
|
|
|
|
|
|
|
# require Scalar::Util; |
420
|
|
|
|
|
|
|
# $o->{CONFIG}{UNTAINT} = |
421
|
|
|
|
|
|
|
# (Scalar::Util::tainted(Cwd::cwd()) ? 1 : 0) ; |
422
|
|
|
|
|
|
|
## Disable SAFEMODE in the test suite, we know what we are doing... |
423
|
|
|
|
|
|
|
# $o->{CONFIG}{SAFEMODE} = 0 ; |
424
|
|
|
|
|
|
|
# warn "\n-[tT] enabled for test suite. |
425
|
|
|
|
|
|
|
#Automatically setting UNTAINT=1 and SAFEMODE=0.\n" |
426
|
|
|
|
|
|
|
# unless $Inline::_TAINT_WARNING_ ; |
427
|
|
|
|
|
|
|
# $Inline::_TAINT_WARNING_ = 1 ; |
428
|
|
|
|
|
|
|
# } ; |
429
|
|
|
|
|
|
|
# } |
430
|
|
|
|
|
|
|
## |
431
|
1
|
|
50
|
|
|
7
|
$untaint = $o->{CONFIG}{UNTAINT} || 0; |
432
|
|
|
|
|
|
|
$safemode = (($o->{CONFIG}{SAFEMODE} == -1) ? |
433
|
|
|
|
|
|
|
($untaint ? 1 : 0) : |
434
|
|
|
|
|
|
|
$o->{CONFIG}{SAFEMODE} |
435
|
1
|
50
|
|
|
|
7
|
); |
|
|
50
|
|
|
|
|
|
436
|
1
|
50
|
33
|
|
|
5
|
if (UNTAINT and |
|
|
|
33
|
|
|
|
|
437
|
|
|
|
|
|
|
SAFEMODE and |
438
|
|
|
|
|
|
|
not $o->{CONFIG}{DIRECTORY}) { |
439
|
0
|
0
|
0
|
|
|
0
|
croak M49_usage_unsafe(1) if ($< == 0 or $> == 0); |
440
|
0
|
0
|
|
|
|
0
|
warn M49_usage_unsafe(0) if $^W; |
441
|
|
|
|
|
|
|
} |
442
|
1
|
50
|
|
|
|
6
|
if ($o->{CONFIG}{AUTONAME} == -1) { |
443
|
1
|
50
|
|
|
|
7
|
$o->{CONFIG}{AUTONAME} = length($o->{CONFIG}{NAME}) ? 0 : 1; |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
$o->{API}{cleanup} = |
446
|
1
|
|
33
|
|
|
9
|
($o->{CONFIG}{CLEAN_AFTER_BUILD} and not $o->{CONFIG}{REPORTBUG}); |
447
|
|
|
|
|
|
|
} |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
#============================================================================== |
450
|
|
|
|
|
|
|
# Check if Inline extension is preinstalled |
451
|
|
|
|
|
|
|
#============================================================================== |
452
|
|
|
|
|
|
|
sub check_installed { |
453
|
1
|
|
|
1
|
0
|
2
|
my $o = shift; |
454
|
1
|
|
|
|
|
3
|
$o->{INLINE}{object_ready} = 0; |
455
|
1
|
50
|
|
|
|
8
|
unless ($o->{API}{code} =~ /^[A-Fa-f0-9]{32}$/) { |
456
|
1
|
|
|
|
|
8
|
require Digest::MD5; |
457
|
1
|
|
|
|
|
8
|
$o->{INLINE}{md5} = Digest::MD5::md5_hex($o->{API}{code}); |
458
|
|
|
|
|
|
|
} |
459
|
|
|
|
|
|
|
else { |
460
|
0
|
|
|
|
|
0
|
$o->{INLINE}{md5} = $o->{API}{code}; |
461
|
|
|
|
|
|
|
} |
462
|
1
|
50
|
|
|
|
6
|
return if $o->{CONFIG}{_INSTALL_}; |
463
|
1
|
50
|
|
|
|
3
|
return unless $o->{CONFIG}{VERSION}; |
464
|
|
|
|
|
|
|
croak M26_error_version_without_name() |
465
|
0
|
0
|
|
|
|
0
|
unless $o->{CONFIG}{NAME}; |
466
|
|
|
|
|
|
|
|
467
|
0
|
|
|
|
|
0
|
my @pkgparts = split(/::/, $o->{API}{pkg}); |
468
|
0
|
|
|
|
|
0
|
my $realname = File::Spec->catfile(@pkgparts) . '.pm'; |
469
|
0
|
|
|
|
|
0
|
my $realname_unix = File::Spec::Unix->catfile(@pkgparts) . '.pm'; |
470
|
0
|
0
|
|
|
|
0
|
my $realpath = $INC{$realname_unix} |
471
|
|
|
|
|
|
|
or croak M27_module_not_indexed($realname_unix); |
472
|
|
|
|
|
|
|
|
473
|
0
|
|
|
|
|
0
|
my ($volume,$dir,$file) = File::Spec->splitpath($realpath); |
474
|
0
|
|
|
|
|
0
|
my @dirparts = File::Spec->splitdir($dir); |
475
|
0
|
0
|
|
|
|
0
|
pop @dirparts unless $dirparts[-1]; |
476
|
0
|
|
|
|
|
0
|
push @dirparts, $file; |
477
|
0
|
|
|
|
|
0
|
my @endparts = splice(@dirparts, 0 - @pkgparts); |
478
|
|
|
|
|
|
|
|
479
|
0
|
0
|
0
|
|
|
0
|
$dirparts[-1] = 'arch' |
480
|
|
|
|
|
|
|
if $dirparts[-2] eq 'blib' && $dirparts[-1] eq 'lib'; |
481
|
0
|
0
|
|
|
|
0
|
File::Spec->catfile(@endparts) eq $realname |
482
|
|
|
|
|
|
|
or croak M28_error_grokking_path($realpath); |
483
|
0
|
|
|
|
|
0
|
$realpath = |
484
|
|
|
|
|
|
|
File::Spec->catpath($volume,File::Spec->catdir(@dirparts),""); |
485
|
|
|
|
|
|
|
|
486
|
0
|
|
|
|
|
0
|
$o->{API}{version} = $o->{CONFIG}{VERSION}; |
487
|
0
|
|
|
|
|
0
|
$o->{API}{module} = $o->{CONFIG}{NAME}; |
488
|
0
|
|
|
|
|
0
|
my @modparts = split(/::/,$o->{API}{module}); |
489
|
0
|
|
|
|
|
0
|
$o->{API}{modfname} = $modparts[-1]; |
490
|
0
|
|
|
|
|
0
|
$o->{API}{modpname} = File::Spec->catdir(@modparts); |
491
|
|
|
|
|
|
|
|
492
|
0
|
|
|
|
|
0
|
my $suffix = $Config{dlext}; |
493
|
|
|
|
|
|
|
my $obj = File::Spec->catfile($realpath,'auto',$o->{API}{modpname}, |
494
|
0
|
|
|
|
|
0
|
"$o->{API}{modfname}.$suffix"); |
495
|
|
|
|
|
|
|
croak M30_error_no_obj($o->{CONFIG}{NAME}, $o->{API}{pkg}, |
496
|
0
|
0
|
|
|
|
0
|
$realpath) unless -f $obj; |
497
|
|
|
|
|
|
|
|
498
|
0
|
|
|
|
|
0
|
@{$o->{CONFIG}}{qw( PRINT_INFO |
|
0
|
|
|
|
|
0
|
|
499
|
|
|
|
|
|
|
REPORTBUG |
500
|
|
|
|
|
|
|
FORCE_BUILD |
501
|
|
|
|
|
|
|
_INSTALL_ |
502
|
|
|
|
|
|
|
)} = (0, 0, 0, 0); |
503
|
|
|
|
|
|
|
|
504
|
0
|
|
|
|
|
0
|
$o->{install_lib} = $realpath; |
505
|
0
|
|
|
|
|
0
|
$o->{INLINE}{ILSM_type} = 'compiled'; |
506
|
0
|
|
|
|
|
0
|
$o->{INLINE}{ILSM_module} = 'Inline::C'; |
507
|
0
|
|
|
|
|
0
|
$o->{INLINE}{ILSM_suffix} = $suffix; |
508
|
0
|
|
|
|
|
0
|
$o->{INLINE}{object_ready} = 1; |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
#============================================================================== |
512
|
|
|
|
|
|
|
# Dynamically load the object module |
513
|
|
|
|
|
|
|
#============================================================================== |
514
|
|
|
|
|
|
|
sub load { |
515
|
0
|
|
|
0
|
0
|
0
|
my $o = shift; |
516
|
|
|
|
|
|
|
|
517
|
0
|
0
|
|
|
|
0
|
if ($o->{CONFIG}{_INSTALL_}) { |
518
|
0
|
|
|
|
|
0
|
my $inline = "$o->{API}{modfname}.inl"; |
519
|
0
|
0
|
|
|
|
0
|
open INLINE, "> $inline" |
520
|
|
|
|
|
|
|
or croak M24_open_for_output_failed($inline); |
521
|
0
|
|
|
|
|
0
|
print INLINE "*** AUTOGENERATED by Inline.pm ***\n\n"; |
522
|
0
|
|
|
|
|
0
|
print INLINE "This file satisfies the make dependency for "; |
523
|
0
|
|
|
|
|
0
|
print INLINE "$o->{API}{modfname}.pm\n"; |
524
|
0
|
|
|
|
|
0
|
close INLINE; |
525
|
0
|
|
|
|
|
0
|
return; |
526
|
|
|
|
|
|
|
} |
527
|
|
|
|
|
|
|
|
528
|
0
|
|
|
|
|
0
|
my ($pkg, $module) = @{$o->{API}}{qw(pkg module)}; |
|
0
|
|
|
|
|
0
|
|
529
|
0
|
0
|
|
|
|
0
|
croak M42_usage_loader() unless $o->{INLINE}{ILSM_type} eq 'compiled'; |
530
|
|
|
|
|
|
|
|
531
|
0
|
|
|
|
|
0
|
require DynaLoader; |
532
|
0
|
|
|
|
|
0
|
@Inline::ISA = qw(DynaLoader); |
533
|
|
|
|
|
|
|
|
534
|
0
|
0
|
|
|
|
0
|
my $global = $o->{CONFIG}{GLOBAL_LOAD} ? '0x01' : '0x00'; |
535
|
0
|
|
0
|
|
|
0
|
my $version = $o->{API}{version} || '0.00'; |
536
|
|
|
|
|
|
|
|
537
|
0
|
|
|
|
|
0
|
eval <
|
538
|
|
|
|
|
|
|
package $pkg; |
539
|
|
|
|
|
|
|
push \@$ {pkg}::ISA, qw($module) |
540
|
|
|
|
|
|
|
unless \$module eq "$pkg"; |
541
|
|
|
|
|
|
|
local \$$ {module}::VERSION = '$version'; |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
package $module; |
544
|
|
|
|
|
|
|
push \@$ {module}::ISA, qw(Exporter DynaLoader); |
545
|
|
|
|
|
|
|
sub dl_load_flags { $global } |
546
|
|
|
|
|
|
|
${module}::->bootstrap; |
547
|
|
|
|
|
|
|
END |
548
|
0
|
0
|
|
|
|
0
|
croak M43_error_bootstrap($module, $@) if $@; |
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
#============================================================================== |
552
|
|
|
|
|
|
|
# Process the config options that apply to all Inline sections |
553
|
|
|
|
|
|
|
#============================================================================== |
554
|
|
|
|
|
|
|
sub handle_global_config { |
555
|
1
|
|
|
1
|
0
|
2
|
my $pkg = shift; |
556
|
1
|
|
|
|
|
3
|
while (@_) { |
557
|
2
|
|
|
|
|
3
|
my ($key, $value) = (shift, shift); |
558
|
2
|
50
|
|
|
|
8
|
croak M02_usage() if $key =~ /[\s\n]/; |
559
|
2
|
50
|
|
|
|
6
|
$key = $value if $key =~ /^(ENABLE|DISABLE)$/; |
560
|
|
|
|
|
|
|
croak M47_invalid_config_option($key) |
561
|
2
|
50
|
|
|
|
7
|
unless defined $default_config->{$key}; |
562
|
2
|
50
|
|
|
|
6
|
if ($key eq 'ENABLE') { |
|
|
50
|
|
|
|
|
|
563
|
0
|
|
|
|
|
0
|
$CONFIG{$pkg}{template}{$value} = 1; |
564
|
|
|
|
|
|
|
} |
565
|
|
|
|
|
|
|
elsif ($key eq 'DISABLE') { |
566
|
0
|
|
|
|
|
0
|
$CONFIG{$pkg}{template}{$value} = 0; |
567
|
|
|
|
|
|
|
} |
568
|
|
|
|
|
|
|
else { |
569
|
2
|
|
|
|
|
46
|
$CONFIG{$pkg}{template}{$key} = $value; |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
} |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
#============================================================================== |
575
|
|
|
|
|
|
|
# Process the config options that apply to a particular language |
576
|
|
|
|
|
|
|
#============================================================================== |
577
|
|
|
|
|
|
|
sub handle_language_config { |
578
|
1
|
|
|
1
|
0
|
3
|
my @values; |
579
|
1
|
|
|
|
|
11
|
while (@_) { |
580
|
0
|
|
|
|
|
0
|
my ($key, $value) = (shift, shift); |
581
|
0
|
0
|
|
|
|
0
|
croak M02_usage() if $key =~ /[\s\n]/; |
582
|
0
|
0
|
|
|
|
0
|
if ($key eq 'ENABLE') { |
|
|
0
|
|
|
|
|
|
583
|
0
|
|
|
|
|
0
|
push @values, $value, 1; |
584
|
|
|
|
|
|
|
} |
585
|
|
|
|
|
|
|
elsif ($key eq 'DISABLE') { |
586
|
0
|
|
|
|
|
0
|
push @values, $value, 0; |
587
|
|
|
|
|
|
|
} |
588
|
|
|
|
|
|
|
else { |
589
|
0
|
|
|
|
|
0
|
push @values, $key, $value; |
590
|
|
|
|
|
|
|
} |
591
|
|
|
|
|
|
|
} |
592
|
1
|
|
|
|
|
6
|
return {@values}; |
593
|
|
|
|
|
|
|
} |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
#============================================================================== |
596
|
|
|
|
|
|
|
# Validate and store shortcut config options |
597
|
|
|
|
|
|
|
#============================================================================== |
598
|
|
|
|
|
|
|
sub handle_shortcuts { |
599
|
0
|
|
|
0
|
0
|
0
|
my $pkg = shift; |
600
|
|
|
|
|
|
|
|
601
|
0
|
|
|
|
|
0
|
for my $option (@_) { |
602
|
0
|
|
|
|
|
0
|
my $OPTION = uc($option); |
603
|
0
|
0
|
|
|
|
0
|
if ($OPTION eq 'SITE_INSTALL') { |
|
|
0
|
|
|
|
|
|
604
|
0
|
|
|
|
|
0
|
croak M58_site_install(); |
605
|
|
|
|
|
|
|
} |
606
|
|
|
|
|
|
|
elsif ($shortcuts{$OPTION}) { |
607
|
0
|
|
|
|
|
0
|
my ($method, $arg) = @{$shortcuts{$OPTION}}; |
|
0
|
|
|
|
|
0
|
|
608
|
0
|
|
|
|
|
0
|
$CONFIG{$pkg}{template}{$method} = $arg; |
609
|
|
|
|
|
|
|
} |
610
|
|
|
|
|
|
|
else { |
611
|
0
|
|
|
|
|
0
|
croak M48_usage_shortcuts($option); |
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
} |
614
|
|
|
|
|
|
|
} |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
#============================================================================== |
617
|
|
|
|
|
|
|
# Process the with command |
618
|
|
|
|
|
|
|
#============================================================================== |
619
|
|
|
|
|
|
|
sub handle_with { |
620
|
0
|
|
|
0
|
0
|
0
|
my $pkg = shift; |
621
|
0
|
0
|
|
|
|
0
|
croak M45_usage_with() unless @_; |
622
|
0
|
|
|
|
|
0
|
for (@_) { |
623
|
0
|
0
|
|
|
|
0
|
croak M02_usage() unless /^[\w:]+$/; |
624
|
0
|
|
|
|
|
0
|
eval "require $_;"; |
625
|
0
|
0
|
|
|
|
0
|
croak M46_usage_with_bad($_) . $@ if $@; |
626
|
0
|
|
|
|
|
0
|
push @{$CONFIG{$pkg}{template}{WITH}}, $_; |
|
0
|
|
|
|
|
0
|
|
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
} |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
#============================================================================== |
631
|
|
|
|
|
|
|
# Perform cleanup duties |
632
|
|
|
|
|
|
|
#============================================================================== |
633
|
|
|
|
|
|
|
sub DESTROY { |
634
|
1
|
|
|
1
|
|
3
|
my $o = shift; |
635
|
1
|
50
|
|
|
|
102
|
$o->clean_build if $o->{CONFIG}{CLEAN_BUILD_AREA}; |
636
|
|
|
|
|
|
|
} |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
# Comment out the next 2 lines to stop autoloading of subroutines (testing) |
639
|
|
|
|
|
|
|
1; |
640
|
|
|
|
|
|
|
__END__ |