stas 01/12/05 08:03:25
Modified: lib/Apache compat.pm
t/apache compat.t
t/response/TestApache compat.pm
Log:
- add 'PerlOptions +GlobalRequest' to avoid core dumps in tests
- warn user if Apache->request fails
- add the returned by tmpfile filename test
Revision Changes Path
1.26 +4 -1 modperl-2.0/lib/Apache/compat.pm
Index: compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- compat.pm 2001/12/05 05:31:09 1.25
+++ compat.pm 2001/12/05 16:03:25 1.26
@@ -301,11 +301,14 @@
my $class = shift;
my $limit = 100;
my $r = Apache->request;
+ unless ($r) {
+ die "'PerlOptions +GlobalRequest' setting is required";
+ }
while ($limit--) {
my $tmpfile = "$TMPDIR/${$}" . $TMPNAM++;
my $fh = $class->new;
sysopen($fh, $tmpfile, $Mode, $Perms);
- $r->register_cleanup(sub { unlink $tmpfile }) if $r;
+ $r->pool->cleanup_register(sub { unlink $tmpfile }) if $r;
if ($fh) {
return wantarray ? ($tmpfile, $fh) : $fh;
}
1.5 +1 -1 modperl-2.0/t/apache/compat.t
Index: compat.t
===================================================================
RCS file: /home/cvs/modperl-2.0/t/apache/compat.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- compat.t 2001/12/05 05:31:09 1.4
+++ compat.t 2001/12/05 16:03:25 1.5
@@ -6,7 +6,7 @@
use Apache::TestUtil;
use Apache::TestRequest;
-plan tests => 20, \&have_lwp;
+plan tests => 21, \&have_lwp;
my $location = "/TestApache::compat";
1.4 +10 -2 modperl-2.0/t/response/TestApache/compat.pm
Index: compat.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestApache/compat.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- compat.pm 2001/12/05 05:31:09 1.3
+++ compat.pm 2001/12/05 16:03:25 1.4
@@ -116,9 +116,15 @@
debug "new+open non-exists";
ok !Apache::File->new("$file.yeahright");
- debug "open tmpfile";
- ok my ($tmpfile, $tmpfh) = Apache::File->tmpfile;
+ # tmpfile
+ my ($tmpfile, $tmpfh) = Apache::File->tmpfile;
+#89573612
+ debug "open tmpfile fh";
+ ok $tmpfh;
+ debug "open tmpfile name";
+ ok $tmpfile;
+
debug "write/read from tmpfile";
my $write = "test $$";
print $tmpfh $write;
@@ -134,3 +140,5 @@
sub debug { $gr->print("# $_\n") for @_; }
1;
+__END__
+PerlOptions +GlobalRequest