use strict;
use vars qw($VERSION %INTERNAL %get %post %fields %header %cookie %BLOCK $DEBUG $output);
-$VERSION = '2.21';
+$VERSION = '2.22';
$DEBUG = 1;
+# We put most everything in %INTERNAL, just so the user won't screw it.
+# We could also have used packages, but let's keep it simple.
+
$INTERNAL{file} = $ENV{PATH_TRANSLATED};
unless (-e $INTERNAL{file}){
$ENV{REDIRECT_STATUS} = '404';
$INTERNAL{qq} = "\10"; #^P
$INTERNAL{q} = "\17"; #^Q
-$header{'content-type'} = 'text/html';
-$header{status} = '200 OK';
+$header{'Content-Type'} = 'text/html';
+$header{Status} = '200 OK';
$INTERNAL{code} = ReadFile($INTERNAL{file});
$INTERNAL{code} =~ s(<\[([^>]*?):(.*?)\]>)($BLOCK{"${1}-1"}$2$BLOCK{"${1}-2"})g;
$INTERNAL{code} =~ s(<\[(?!/)(.*?)\]>)($BLOCK{"${1}-1"})g;
$INTERNAL{code} =~ s(<\[/(.*?)\]>)($BLOCK{"${1}-2"})g;
+
+
$INTERNAL{code} =~ s(<{[ \08\09]*)($INTERNAL{q};print qq$INTERNAL{qq})g;
$INTERNAL{code} =~ s([ \08\09]*}>)($INTERNAL{qq};print q$INTERNAL{q})g;
$INTERNAL{code} = "print q$INTERNAL{q}$INTERNAL{code}$INTERNAL{q};";
}
}
-for (keys %header){
- print "$_: $header{$_}\n";
+print "\n\n" if $DEBUG == 2;
+
+{
+ my %HEADER;
+ for (sort keys %header){ # Sort, so lowercase and underscores come first)
+ my $copy = $_;
+ tr/_/-/;
+ s/\b(\w)(\w*)/\U$1\E\L$2\E/g;
+ $HEADER{$_} = $header{$copy};
+ }
+ for (keys %HEADER){
+ print "$_: $HEADER{$_}\n";
+ }
+ print "\n";
}
-print "\n";
{
no strict;