perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@cpan.org>
Subject Re: Apache::ReadConfig and method handlers
Date Wed, 04 Jun 2003 07:46:50 GMT
On Wed, 2003-06-04 at 14:55, Issac Goldstand wrote:
> After a few fruitless days of fiddling with this, I find myself getting
> nowhere...  Can anyone really explain how Apache::ReadConfig and/or direct
> me to the source code (for handling the namespace, not the code for <Perl>
> sections)

Simple as simple gets.

If you have

<Perl handler=My::Handler>
 $foo = 1;
 $bar = 2;
</Perl>

Will call:
My::Handler->handler

sub My::Handler::handler : handler {
	my($self, $parms, $args) = @_;
	#do your thing!
}

$self is self-explanatory
$parms is the Apache::CmdParms for this Container, for example, you
might want to call $parms->server() to get the current server.

$args is a APR::Table of your arguments, the 2 guaranteed ones will be:

$args->{'handler'} = 'My::handler::handler'; # in  this case
$args->{'package'} = 'Apache::ReadConfig';

And $args->{'package'} will be the name of the package your code got
'eval'ed into, for this example

$Apache::ReadConfig::foo = 1;
$Apache::ReadConfig::bar = 2;

From then on, it's up to you to navigate the namespace and do your
thing. For inspiration you can look at lib/Apache/PerlSections.pm, the
default handler for this.

Also, keep in mind that as things stand right now, this is a bit buggy,
pending one of many possible fixes (by me ;-()

More info on the current borked state ican be found around this thread :
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=105401421410654&w=2

Does this help you ?
>   Issac
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
-- 
-- -----------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/    F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'

Mime
View raw message