You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by JT Smith <jt...@plainblack.com> on 2005/11/05 18:58:28 UTC

2 init handlers

My modperl app has its own init handler, but I'd also like to use Apache2::Reload on my 
dev box so I don't have to continue restarting Apache. Is it possible to register 2 init 
handlers through the Apache config? If not, is it possible to register them through 
code?

JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com

I reject your reality, and substitute my own. ~ Adam Savage

Re: 2 init handlers

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

JT Smith wrote:
> Thanks. I tried adding multiple lines worth and that didn't seem to
> work, not sure why. I didn't try putting multiple on the same line. I'll
> give that a shot.

it shouldn't really matter - see hooks/TestHooks/stacked_handlers2.pm in the
mp2 test suite.  if the t/hooks/stacked_handlers2.t test passes then
something else must be going on somewhere in your handlers...

--Geoff

Re: 2 init handlers

Posted by JT Smith <jt...@plainblack.com>.
Thanks. I tried adding multiple lines worth and that didn't seem to work, not sure why. 
I didn't try putting multiple on the same line. I'll give that a shot.

> sure, slather on as many as you want
> 
>  PerlInitHandler My::Foo My::Bar
>  PerlInitHandler My::Baz
> 
> and they'll all get run.  provided nobody throws an error, that is :)




JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382
http://www.plainblack.com

I reject your reality, and substitute my own. ~ Adam Savage

Re: 2 init handlers

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

JT Smith wrote:
> My modperl app has its own init handler, but I'd also like to use
> Apache2::Reload on my dev box so I don't have to continue restarting
> Apache. Is it possible to register 2 init handlers through the Apache
> config? 

sure, slather on as many as you want

  PerlInitHandler My::Foo My::Bar
  PerlInitHandler My::Baz

and they'll all get run.  provided nobody throws an error, that is :)

the only place where this isn't true is for translation, authen/authz, and
mime setting phases, where you can register as many as you want but the
first one to return OK prevents the rest from being run.

> If not, is it possible to register them through code?

you can always use $r->push_handlers() to do that as well.

HTH

--Geoff