stas 2003/05/29 19:15:52
Modified: t/hooks/TestHooks cleanup2.pm
Log:
it's more interesting to use $r->pool->cleanup_register since it can
accept an arbitrary argument.
Revision Changes Path
1.2 +5 -4 modperl-2.0/t/hooks/TestHooks/cleanup2.pm
Index: cleanup2.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/cleanup2.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- cleanup2.pm 30 May 2003 02:09:57 -0000 1.1
+++ cleanup2.pm 30 May 2003 02:15:52 -0000 1.2
@@ -14,6 +14,7 @@
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
+use APR::Pool ();
use Apache::Const -compile => qw(OK DECLINED);
use APR::Const -compile => 'SUCCESS';
@@ -31,17 +32,17 @@
my $status = $r->sendfile($file);
die "sendfile has failed" unless $status == APR::SUCCESS;
- $r->push_handlers(PerlCleanupHandler => \&cleanup);
+ $r->pool->cleanup_register(\&cleanup, $file);
return Apache::OK;
}
sub cleanup {
- my $r = shift;
+ my $file_arg = shift;
debug_sub "called";
- die "Can't find file: $file" unless -e $file;
- unlink $file or die "failed to unlink $file";
+ die "Can't find file: $file_arg" unless -e $file_arg;
+ unlink $file_arg or die "failed to unlink $file_arg";
return Apache::OK;
}