use warnings;
use Exporter;
-sub Wrequire($);
+sub Wrequire($%);
sub Wuse($@);
our $W;
our @EXPORT=qw(
$W
&input_hidden_persistents
&escapeHTML
+ &form_method
);
our @ISA=qw(Tie::Handle Exporter);
use Carp qw(cluck confess);
$W->{"__My::Web_init"}=1;
- sub Wrequire ($)
+ # $args{"first"}=1
+ sub Wrequire ($%)
{
- my($file)=@_;
+ my($file,%args)=@_;
# print STDERR "Wrequire $file\n";
$file=~s#/#::#g;
$callers{$selfpkg}=1;
for my $target ($class,__PACKAGE__) {
for my $caller (keys(%callers)) {
- next if $caller eq $target;
next if $packages_used_hash{$caller}{$target}++;
cluck "Appending to the '_done' package list: caller=$caller,target=$target"
if $packages_used_hash{$caller}{"_done"};
- push @{$packages_used_array{$caller}},$target;
+ if ($args{"first"}) {
+ unshift @{$packages_used_array{$caller}},$target;
+ }
+ else {
+ push @{$packages_used_array{$caller}},$target;
+ }
}
}
eval { CORE::require "$file"; } or confess $@;
require Data::Compare;
use Data::Dumper;
require Encode;
+use Apache2::RequestUtil;
use Apache2::Filter;
use Apache2::Connection;
require MIME::Base64;
use Apache2::ServerUtil;
require MIME::Types;
require MIME::Parser;
+use Apache2::RequestRec;
+use Apache2::RequestIO;
+use Apache2::Response;
#our $W;
# $Apache2::Registry::curstash is no longer supported.
do { cluck "No $_" if !$W->{$_}; } for "__PACKAGE__";
exit_hook_start();
+ # Package dependencies tracking only:
+ Wrequire $W->{"__PACKAGE__"},"first"=>1;
do { $W->{$_}=0 if !defined $W->{$_}; } for "detect_ent";
do { $W->{$_}=0 if !defined $W->{$_}; } for "detect_js";
$$_=0 if !defined $$_;
}
}
+ # Used only if: $W->{"http_safe"}
+ # but we would cause on different method(): Appending to the '_done' package list
+ Wrequire 'My::Hash::RecordKeys';
if ($W->{"http_safe"}) {
- Wrequire 'My::Hash::RecordKeys';
$W->{"headers_in_RecordKeys"}=My::Hash::RecordKeys->new($W->{"headers_in"});
$W->{"headers_in"}=$W->{"headers_in_RecordKeys"};
}
$W->{"head"}.='<script type="application/javascript" src="'.uri_escaped(path_web('/My/HaveJS.pm')).'"></script>'."\n";
}
- do { _args_check(%$_) if $_; } for ($W->{"args_check"});
-
+ # Required by &_args_check below.
$W->{"_init_done"}=1;
+
+ do { _args_check(%$_) if $_; } for $W->{"args_check"};
+
return $W;
}
+sub form_method($)
+{
+my($method)=@_;
+
+ return q{enctype="application/x-www-form-urlencoded" accept-charset="us-ascii utf-8"} if $method eq "post";
+ return q{accept-charset="us-ascii utf-8"} if $method eq "get";
+ cluck "Undefined method: $method";
+ return ""
+}
+
sub merge_post_args($)
{
my($class)=@_;
if (!$W->{"heading_done"}) {
$W->{"indexme"}=0; # For the case no heading was sent yet.
$W->{"header_only"}=0; # assurance for &heading
+ $W->{"content_type"}="text/html"; # Force HTML and avoid strictly checked XHTML.
My::Web->heading();
}
Wprint "\n".vskip("3ex")."<hr /><h1 class=\"error\">FATAL ERROR: $msg!</h1>\n"
sub cache_start()
{
+ # Used only if: !$W->{"http_safe"}
+ # but we would cause on different method(): Appending to the '_done' package list
+ # &Wrequire it here even if it will not be later used; to be stable!
+ Wrequire 'My::Hash::RestrictTo';
if (!$W->{"http_safe"}) {
__PACKAGE__->_no_cache();
return;
}
{
- # &Wrequire it here even if it will not be later used; to be stable!
- Wrequire 'My::Hash::RestrictTo';
my %uri_args_hash=(
"method"=>$W->{"r"}->method(),
"uri"=>"http://".$W->{"web_hostname"}."/".$W->{"r"}->uri(),