stas 2003/08/22 20:35:16
Modified: t/hooks/TestHooks access.pm
Log:
add tracing, so it's easier to prove that all phases are run only once
Revision Changes Path
1.3 +24 -2 modperl-2.0/t/hooks/TestHooks/access.pm
Index: access.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/hooks/TestHooks/access.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- access.pm 11 Apr 2002 11:08:43 -0000 1.2
+++ access.pm 23 Aug 2003 03:35:16 -0000 1.3
@@ -1,11 +1,17 @@
package TestHooks::access;
+# demonstrates the phases execution (sometimes users claim that
+# PerlInitHandler is running more than once
+# run with:
+# t/TEST -trace=debug -v hooks/access
+
use strict;
use warnings FATAL => 'all';
use APR::Table ();
use Apache::Access ();
use Apache::RequestRec ();
+use Apache::TestTrace;
use Apache::Const -compile => qw(OK FORBIDDEN);
@@ -16,12 +22,28 @@
my $fake_ip = $r->headers_in->get('X-Forwarded-For') || "";
+ debug "access: " . ($fake_ip =~ $allowed_ips ? "OK\n" : "FORBIDDEN\n");
+
return Apache::FORBIDDEN unless $fake_ip =~ $allowed_ips;
Apache::OK;
}
+sub fixup { debug "fixup\n"; Apache::OK }
+sub init { debug "init\n"; Apache::OK }
+
1;
__DATA__
-PerlResponseHandler Apache::TestHandler::ok1
-SetHandler modperl
+<NoAutoConfig>
+PerlModule TestHooks::access
+<Location /TestHooks__access>
+ PerlAccessHandler TestHooks::access
+ PerlInitHandler TestHooks::access::init
+ PerlFixupHandler TestHooks::access::fixup
+ PerlResponseHandler Apache::TestHandler::ok1
+ SetHandler modperl
+</Location>
+#<Location />
+# PerlAccessHandler TestHooks::access
+#</Location>
+</NoAutoConfig>