perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perrin Harkins" <>
Subject Re: and RegistryCooker
Date Tue, 09 Dec 2008 19:51:53 GMT
On Sat, Dec 6, 2008 at 2:48 PM, William Ahern
<> wrote:
> I was forced to move from mod_perl to mod_perl2 because of Ubuntu.

Don't let Ubuntu push you around.  If you want to run mod_perl 1, go
ahead.  You don't need the Ubuntu packages.

> Anyhow, unfortunately for me, I'm using exceptions all over the
> place. One way I use it is for redirection: throw E:Redirect url =>
> http://foo. And I'm wrapping the RegistryCooker handler (Registry handler in
> mod_perl 1). I have a catch statement in my handler, though I guess I never
> realized that my redirect trick was working by accident in mod_perl 1, and
> now it doesn't work at all in mod_perl 2. (By accident because the
> default_handler executes the page in an eval {})

Nested evals should work.  However, I'd suggest you avoid the
try/catch syntax of because it can lead to other problems.

> The redirect exception object construction sets the Location header and
> status code. With mod_perl 1 I guess this was enough to get the job done,
> but with mod_perl 2 this just doesn't fly. (I Suppose now mod_perl 2 munges
> the status code).

You're probably just not setting the headers correctly.  Look at some
examples like these:

> Re-writing the default handler (which loads and caches the pages)
> seems like the most work, so I'm looking for an easier answer, if any ;) For
> that effort it seems I might was well grab Cocoon 3 and switch to Java.

It's actually intended to be easy to inherit from the base Registry
handler and change behavior.  Check out ModPerl::RegistryCooker if you
ever need to do this.

- Perrin

View raw message