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 do...@apache.org on 2002/08/24 18:11:43 UTC
cvs commit: modperl-2.0/t/conf modperl_extra.pl
dougm 2002/08/24 09:11:43
Modified: t/conf modperl_extra.pl
Log:
add <Perl> handler for testing/example
Revision Changes Path
1.17 +38 -0 modperl-2.0/t/conf/modperl_extra.pl
Index: modperl_extra.pl
===================================================================
RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- modperl_extra.pl 23 May 2002 22:40:47 -0000 1.16
+++ modperl_extra.pl 24 Aug 2002 16:11:43 -0000 1.17
@@ -62,6 +62,44 @@
return $buf;
}
+#<Perl handler=ModPerl::Test::perl_section>
+# ...
+#</Perl>
+sub ModPerl::Test::perl_section {
+ my($parms, $args) = @_;
+
+ require Apache::CmdParms;
+ require Apache::Directive;
+
+ my $code = $parms->directive->to_string;
+ my $package = $args->{package} || 'Apache::ReadConfig';
+
+## a real handler would do something like:
+# eval "package $package; $code";
+# die $@ if $@;
+## feed %Apache::ReadConfig:: to Apache::Directive->insert
+
+ my $htdocs = Apache::server_root_relative($parms->pool, 'htdocs');
+
+ my @cfg = (
+ "Alias /perl_sections $htdocs",
+ "<Location /perl_sections>",
+ " require valid-user",
+ " AuthType Basic",
+ " AuthName PerlSection",
+ " PerlAuthenHandler TestHooks::authen",
+ "</Location>",
+ );
+
+ my $errmsg = Apache::Directive->insert($parms->server,
+ $parms->pool,
+ \@cfg);
+
+ die $errmsg if $errmsg;
+
+ Apache::OK;
+}
+
END {
warn "END in modperl_extra.pl, pid=$$\n";
}