#!/usr/local/bin/perl -Tw
use
vars
qw($Scalar @Array %Hash)
;
not
$filename
or
die
"Apache::Registry scoping is broken!\n"
;
if
(
$USE_THREAD
) {
warn
"must fix \$/ for threaded Perl\n"
;
}
else
{
$/ eq
"\n"
or
die
"\$/ was not reset!\n"
;
$/ =
""
;
}
@Array
== 0 or
die
"END block was not run for $0\n"
;
keys
%Hash
== 0 or
die
"__ANON__ registered cleanup failed!\n"
;
if
(
defined
$Scalar
) {
$Scalar
== 0 or
die
"register_cleanup is broken!\n"
;
}
@Array
=
qw(one two three)
;
%Hash
=
qw(one 1 two 2 three 3)
;
$Scalar
= 1;
my
$r
= Apache->request;
local
$ENV
{PATH} =
"/bin"
;
$is_xs
= (
$r
->uri =~ /_xs/);
sub
reset_scalar {
$Scalar
= 0;
return
0;
}
$r
->post_connection(
sub
{
my
$r
=
shift
;
unless
(Apache::test::WIN32()) {
my
$loc
=
$r
->uri;
$loc
=~ /test/i or
die
"post_connection can't see \$r->uri! ($loc)\n"
;
}
return
0;
});
$r
->post_connection(\
&reset_scalar
);
$r
->post_connection(
sub
{
%Hash
= ();
return
0;
});
if
(
$Apache::TestSIG
) {
Apache::SIG->set;
}
$r
->header_out(
"X-Perl-Script"
=>
"test"
);
$r
->send_http_header(
"text/plain"
);
my
(
@args
);
$r
->
print
(
"KeyForPerlSetVar = "
,
$r
->dir_config(
'KeyForPerlSetVar'
),
"\n"
);
if
(
$Apache::TestSIG
) {
sleep
(30);
}
my
$scalar_args
=
$r
->args;
print
"SCALAR_ARGS=$scalar_args\n"
if
defined
$scalar_args
;
if
(
@args
=
$r
->args) {
$r
->
print
(
"ARGS: "
,
join
(
", "
,
map
{
$_
=
qq{"$_"}
}
@args
),
"\n\n"
);
}
else
{
$r
->
print
(
"No command line arguments passed to script\n\n"
);
}
my
(
$key
,
$val
);
while
((
$key
,
$val
) =
each
%ENV
) {
$r
->
print
(
"$key=$val\n"
);
}
$r
->
print
(
"TOTAL: "
,
scalar
keys
%ENV
);
unless
(
$Apache::__T
) {
die
"\$Apache::__T not set!"
;
}
if
(
$ENV
{CONTENT_LENGTH}) {
my
$content
=
$r
->content;
my
$r_content_will_not_block_when_called_twice
=
$r
->content;
eval
{
system
$content
};
die
"TaintCheck failed, I can `system \$content' ($content:$ENV{CONTENT_LENGTH})"
unless
$@;
$r
->
print
(
"\nContent\n-------\n$content"
);
if
(
my
$post
=
$r
->subprocess_env(
"POST_DATA"
)) {
print
"\nPOST_DATA=`$post'\n"
;
}
}
print
"\n"
;
if
(
defined
&Apache::system
and \
&system
== \
&Apache::system
) {
system
qq{$Config::Config{perlpath}
-le
'print "Apache::system ok"'
};
}
test_exit();
sub
test_exit {
if
(
$USE_THREAD
or
$is_xs
) {
warn
"XXX: need to fix exit in t/net/header.t w/ threads\n"
;
}
else
{
exit
;
die
"shouldn't get this far!\n"
;
}
}
END {
@Array
= ();
}