You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2003/05/09 05:33:37 UTC
cvs commit: modperl-2.0/t/filter/TestFilter in_init_basic.pm
stas 2003/05/08 20:33:37
Modified: t/filter/TestFilter in_init_basic.pm
Log:
test that we can call $f->remove in init filter handlers
Revision Changes Path
1.2 +12 -2 modperl-2.0/t/filter/TestFilter/in_init_basic.pm
Index: in_init_basic.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/in_init_basic.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- in_init_basic.pm 17 Apr 2003 08:04:47 -0000 1.1
+++ in_init_basic.pm 9 May 2003 03:33:37 -0000 1.2
@@ -18,7 +18,7 @@
# this filter is expected to be called once
# it'll set a note, with the count
-sub init : FilterInitHandler {
+sub transparent_init : FilterInitHandler {
my $filter = shift;
my $ctx = $filter->ctx;
@@ -32,7 +32,7 @@
# this filter passes the data through unmodified and sets a note
# counting how many times it was invoked
sub transparent : FilterRequestHandler
- FilterHasInitHandler(\&init)
+ FilterHasInitHandler(\&transparent_init)
{
my ($filter, $bb, $mode, $block, $readbytes) = @_;
@@ -47,6 +47,15 @@
return Apache::OK;
}
+
+
+# this filter is not supposed to get a chance to run, since its init
+# handler immediately removes it
+sub suicide_init : FilterInitHandler { shift->remove(); Apache::OK }
+sub suicide : FilterHasInitHandler(\&suicide_init) {
+ die "this filter is not supposed to have a chance to run";
+}
+
sub response {
my $r = shift;
@@ -67,4 +76,5 @@
SetHandler modperl
PerlModule TestFilter::in_init_basic
PerlResponseHandler TestFilter::in_init_basic::response
+PerlInputFilterHandler TestFilter::in_init_basic::suicide
PerlInputFilterHandler TestFilter::in_init_basic::transparent