perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Fould" <willfo...@gmail.com>
Subject re-factoring 'print' for $r
Date Sat, 22 Dec 2007 20:37:45 GMT
Greeting: I've got a style-related question:

We have dozens of application packages running neatly under MP2 but that all
still use 'print' and also call other packages to print needed headers, etc.

I've created a single handler package (called 'mnh') that now answers all
requests using the request record $r.  Instead of each application handling
the requests, my new handler directs requests to the correct packages from
which the responses are normally 'print'-ed.

Since all of the applications are separate packages, my intention is to just
replace the 'print' statements in each package with something like this:

    $mnh::r->print( $package_response );

Similarly, separate packages are currently used to send headers (like
cookies, content-type, etc) - they also uses the 'print' statement.  I'm
planning to  re-factor this too by using the correct methods for $mnh::r  as
well.

My general question:

Is this a reasonable approach? Is it typical to refer to the request object
by package name rather than try to painfully re-factor all packages and subs
to accept $r as a passed reference?


Thanks a WHOLE lot for your opinions and advice!

Mime
View raw message