You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Issac Goldstand <ma...@beamartyr.net> on 2003/06/04 08:55:37 UTC

Apache::ReadConfig and method handlers

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)

  Issac


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: Apache::ReadConfig and method handlers

Posted by Stas Bekman <st...@stason.org>.
Philippe M. Chiasson wrote:
> 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)

Was Issac asking about mp1 maybe? Guys, please make yourself clear when you 
ask this kind of questions. Philippe's answer is for mp2, but it's similar in mp1.

> 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
> 


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: Apache::ReadConfig and method handlers

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
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}'

Re: Apache::ReadConfig and method handlers

Posted by "Philippe M. Chiasson" <go...@cpan.org>.
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}'