For all fans of zombie web application frameworks.

Kieren Diment diment at
Fri Sep 19 12:19:02 BST 2014

Posting here because it seems the most likely place I can pick up
afficionados of zombie technology :)  And to because it's home.
Might be able to make it to the next meeting to do a talk about it.

I have inherited a codebase that's about 200k lines.  It started life as a
set of CGI scripts about 10 years ago, and made afrankenstein transtion to
a mod_perl application about 5 years ago.  My goal is to turn it into PSGI
and progressively refactor
it so that the (otherwise ok to good model code) will run under Catalyst.
For bonus points it contains swathes of dead code but nobody quite knows
where the dead code is.  The dead code is often deeply nested in if else
blocks.  I've done some work with PPI to interrogate it thoroughly, but in
the end I needed to find a way of pulling off a near equivalent of
PSGI->finalize.  Here is where I am asking for sage advice.

First up I figured I'd try Class::Method::Modifiers in a subclass of

package Apache2::ShimRequest;
use parent 'Apache2::Request'; use

 before print => sub {
     my ($r, @stuff) = @_;
      ...; # log the crap out of $r and stuff, and make a stacktrace.

which failed miserably.

So then I tried to do it in the documented fashion:

 package Apache2::ShimRequest; use Apache2::Request; our @ISA =

 sub do_print { my ($self, @output) = @_;
                      ...; #same }

followed by a find . -name '*pm' | xargs perl -p -i -e

Which works, but is itself miserable.  Bonus points, $tt->_output seems to
obtain an Apache2::RequestRes, not an Apache2::Req so needs a monkey patch.

Can anyone suggest a better way™?

More information about the mailing list