line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Website; |
2
|
1
|
|
|
1
|
|
396849
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2649
|
|
3
|
|
|
|
|
|
|
######################################################################## |
4
|
|
|
|
|
|
|
# Website - Perl extension for as engine to render template-driven |
5
|
|
|
|
|
|
|
# applications, designed to run quickly in CGI and mod_perl environments |
6
|
|
|
|
|
|
|
######################################################################## |
7
|
|
|
|
|
|
|
my $package = __PACKAGE__; |
8
|
|
|
|
|
|
|
our $VERSION = '1.14.01'; |
9
|
|
|
|
|
|
|
$| = 1; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#----- GLOBAL VARS |
12
|
|
|
|
|
|
|
my %Var; # Variables to replace |
13
|
|
|
|
|
|
|
my $contentType; # 1=Content-type is already set / 0=it's not set yet |
14
|
|
|
|
|
|
|
my $begin_block = '$/; # Suppress free comment lines |
190
|
0
|
0
|
|
|
|
|
$next = 0 if /^/; |
191
|
0
|
0
|
|
|
|
|
next if $next; |
192
|
|
|
|
|
|
|
|
193
|
0
|
|
|
|
|
|
foreach my $Key (keys %Var) { |
194
|
0
|
|
|
|
|
|
my $to_be_replaced = 0; |
195
|
0
|
0
|
|
|
|
|
if ($Glob_Args{'output'}) { |
196
|
0
|
0
|
|
|
|
|
$to_be_replaced = 1 if /$start_seq/; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
s/$start_seq$Key$stop_seq/$Var{$Key}/g; |
200
|
|
|
|
|
|
|
|
201
|
0
|
0
|
|
|
|
|
if ($Glob_Args{'output'}) { |
202
|
0
|
0
|
|
|
|
|
unless ($Glob_Args{_Lo_Row}) { |
203
|
0
|
0
|
0
|
|
|
|
print TUNING |
204
|
|
|
|
|
|
|
sprintf("%08d", $rowcount), "\t$Key\n" |
205
|
|
|
|
|
|
|
if $_ !~ /$start_seq/ && $to_be_replaced; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
0
|
0
|
|
|
|
|
next if /{%.+%}$/; # supress unresolved lines |
211
|
|
|
|
|
|
|
|
212
|
0
|
0
|
|
|
|
|
$Params{'save_as'} ? print SAVE : print; |
213
|
|
|
|
|
|
|
} |
214
|
0
|
|
|
|
|
|
$rowcount++; |
215
|
|
|
|
|
|
|
|
216
|
0
|
0
|
|
|
|
|
if ($Glob_Args{_Tune_File_Exists}) { |
217
|
0
|
0
|
|
|
|
|
next if $#Parse_Lines < 1; |
218
|
0
|
0
|
|
|
|
|
if ($rowcount > $Parse_Lines[0]) { |
219
|
0
|
|
|
|
|
|
@Parse_Lines = @Parse_Lines[1 .. $#Parse_Lines]; |
220
|
|
|
|
|
|
|
# At line $rowcount, we will just output the file |
221
|
|
|
|
|
|
|
# until we reach line number $Parse_Lines[0] - 2 |
222
|
0
|
|
|
|
|
|
while () { |
223
|
0
|
0
|
|
|
|
|
last if $rowcount++ > $Parse_Lines[0] - 2; |
224
|
0
|
|
|
|
|
|
print; |
225
|
|
|
|
|
|
|
} |
226
|
0
|
|
|
|
|
|
foreach my $Key (keys %Var) { |
227
|
0
|
|
|
|
|
|
s/$start_seq$Key$stop_seq/$Var{$Key}/g; |
228
|
|
|
|
|
|
|
} |
229
|
0
|
|
|
|
|
|
print; |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
0
|
0
|
0
|
|
|
|
if ($Glob_Args{'output'} && $Glob_Args{_Lo_Row}) { |
234
|
0
|
0
|
|
|
|
|
last if $rowcount > $Glob_Args{_Hi_Row}; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
} # end while |
238
|
|
|
|
|
|
|
|
239
|
0
|
0
|
|
|
|
|
if ($Glob_Args{'output'}) { |
240
|
0
|
|
|
|
|
|
print while ; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
|
|
|
close WS_F; |
244
|
0
|
0
|
0
|
|
|
|
close TUNING |
245
|
|
|
|
|
|
|
if $Glob_Args{'output'} && !$Glob_Args{_Tune_File_Exists}; |
246
|
|
|
|
|
|
|
|
247
|
0
|
0
|
|
|
|
|
if ($Params{'save_as'}) { |
248
|
0
|
0
|
|
|
|
|
print SAVE qq~ |
249
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
~, "\n" unless $Params{'quiet'}; |
257
|
0
|
|
|
|
|
|
close SAVE ; |
258
|
|
|
|
|
|
|
} |
259
|
|
|
|
|
|
|
else { |
260
|
0
|
0
|
|
|
|
|
unless ($Params{'quiet'}) { |
261
|
0
|
0
|
|
|
|
|
print qq~ |
262
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
~, "\n" unless $Params{'quiet'}; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub let { |
275
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
|
my $Key = shift; |
278
|
0
|
|
|
|
|
|
my $Value = shift; |
279
|
0
|
|
0
|
|
|
|
my $Block = shift || ''; |
280
|
|
|
|
|
|
|
|
281
|
0
|
0
|
|
|
|
|
Debug "$Key = $Value" if $self->{'debug'}; |
282
|
|
|
|
|
|
|
|
283
|
0
|
0
|
|
|
|
|
if ($Block) { |
284
|
0
|
|
|
|
|
|
$Var{"_$Block\t" . sprintf("%08d", $Glob_Args{"BLOCK_$Block"}++) . "\t$Key"} = $Value; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
else { |
287
|
0
|
|
|
|
|
|
$Var{$Key} = $Value; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub block ($$@) { |
292
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
293
|
0
|
|
|
|
|
|
my $block_name = shift; |
294
|
0
|
|
|
|
|
|
my %block_args = @_; |
295
|
|
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
push @block_names, $block_name; |
297
|
0
|
|
|
|
|
|
$print_block{$block_name} = $block_args{'print'}; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
sub workdir ($) { |
301
|
0
|
|
|
0
|
0
|
|
my $dir_separator = '/'; # ZZ change this to \ on windows |
302
|
0
|
|
|
|
|
|
my @elems = split /$dir_separator/, $_[0]; |
303
|
|
|
|
|
|
|
|
304
|
0
|
|
|
|
|
|
((join $dir_separator, @elems[0 .. $#elems - 1]), $elems[$#elems]); |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
#### Error ################################################# |
308
|
|
|
|
|
|
|
sub Error ($) { |
309
|
0
|
0
|
|
0
|
0
|
|
print "Content-type: text/html\n\n" unless $contentType; |
310
|
0
|
|
|
|
|
|
print "ERROR ($package): $_[0]\n"; |
311
|
0
|
|
|
|
|
|
exit(1); |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
#### Debug ################################################### |
315
|
|
|
|
|
|
|
sub Debug ($) { |
316
|
0
|
0
|
|
0
|
0
|
|
print "Content-type: text/html\n\n" unless $contentType; $contentType++; |
|
0
|
|
|
|
|
|
|
317
|
0
|
|
|
|
|
|
print "[ $package ] $_[0] \n"; |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
############################################################ |
321
|
|
|
|
|
|
|
#### Used Warning / Error Codes ########################## |
322
|
|
|
|
|
|
|
############################################################ |
323
|
|
|
|
|
|
|
# Next free W Code: 1000 |
324
|
|
|
|
|
|
|
# Next free E Code: 1002 |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
1; |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
__END__ |