# $W={} can get somehow created very easily.
cluck "W not empty:\n".Dumper($W) if keys(%$W);
- $W=bless My::Hash->new({}),$class;
- $W=My::Hash->new($W,"My::Hash::Sub","My::Hash::Push");
+ $W=My::Hash->new({},"My::Hash::Sub","My::Hash::Push");
+ bless $W,$class;
%$W=(
"__PACKAGE__"=>scalar(caller()),
%WebConfig,
};
if (!defined $W->{"have_style"}) {
- $W->{"have_style"}=(!$W->{"browser"}->netscape() || ($W->{"browser"}->major() && $W->{"browser"}->major()>4) ? 1 : 0);
+ $W->{"have_style"}=sub {
+ # Lazy-evaluation, we may not need the "User-Agent" header at all.
+ return our $r||=(!$W->{"browser"}->netscape() || ($W->{"browser"}->major() && $W->{"browser"}->major()>4) ? 1 : 0);
+ };
}
$W->{"have_js"}=($W->{"args"}{"have_js"} ? 1 : 0);
exit;
}
+sub footer_packages_used_comments()
+{
+ my $packages_used=$packages_used_array{$W->{"__PACKAGE__"}};
+ for my $package (@$packages_used) {
+ my $cvs_id=(eval('$'.$package."::CVS_ID")
+# || $package # debug
+ );
+ Wprint '<!-- '.$package.' - $'.$cvs_id.'$ -->'."\n" if $cvs_id;
+ }
+}
+
sub footer()
{
cluck 'Explicit &footer call is deprecated, !_exit_dne' if !$W->{"_exit_done"};
exit if $W->{"footer_done"}++; # deadlock prevention:
+ &{$_}() for reverse @{$W->{"footer_sub_push"}};
if ($W->{"header_only"}) {
$packages_used_hash{$W->{"__PACKAGE__"}}{"_done"}=1;
exit;
Wprint "</p>\n";
}
- for my $package (@$packages_used) {
- my $cvs_id=(eval('$'.$package."::CVS_ID")
-# || $package # debug
- );
- Wprint '<!-- '.$package.' - $'.$cvs_id.'$ -->'."\n" if $cvs_id;
- }
+ packages_used_comments();
do { Wprint $_ if $_; } for $W->{"footing"};
$W->{"r"}->headers_out()->{"Location"}=$url;
$W->{"header_only"}=1;
$W->{"content_type"}=0;
+ $W->{"charset"}=0;
My::Web->heading();
exit;
die "NOTREACHED";
header("Cache-Control"=>"public"); # HTTP/1.1
# Use $W->{"charset"}=0 to disable charset.
- $W->{"charset"}="us-ascii" if !defined $W->{"charset"} && !defined($W->{"content_type"}) || $W->{"content_type"};
+ $W->{"charset"}="us-ascii"
+ if !defined $W->{"charset"} && (!defined($W->{"content_type"}) || $W->{"content_type"});
# Workaround bug
# https://bugzilla.mozilla.org/show_bug.cgi?id=120556
# FIXME: It is not clean to still append them without overwriting.
return if $W->{"heading_done"};
Wprint '<?xml version="1.0" encoding="'.$W->{"charset"}.'"?>'."\n"
- if (!$W->{"header_only"} || $W->{"header_only"} eq "xml") && $W->{"content_type"}=~m{^application/\w+[+]xml$};
+ if (!$W->{"header_only"} || $W->{"header_only"} eq "xml") && (0
+ || $W->{"content_type"}=~m{^application/\w+[+]xml$}
+ || $W->{"content_type"} eq "text/vnd.wap.wml");
return if $W->{"header_only"};
# Split 'heading_done' for the proper handling of: /project/Rel.pm
$W->{"heading_done"}++;