|Don't ask to ask, just ask|
Subclassing Apache::Request?by tadamec (Beadle)
|on Aug 11, 2004 at 01:11 UTC||Need Help??|
tadamec has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to create a subclass of Apache::Request for an application here at work, and I just can't seem to get my head around why it's not working.
The current application passes data to various functions via Apache::Session::Postgres and there is no consistency between the (many) developers who've worked on the system; in one function, everything may be localized into a session "namespace", while another may dump the variables directly into the root of the session hash, or they may combine the two. I'd like to fix this. The data still needs to be stored in some sort of session, as most of the application is multiple, "wizard" type forms.
I figured it would be nice to subclass the Apache::Request object and place various methods for storing the values in the inherited request object. I can't seem to get this working and I've hit a wall. I've got this so far:
Then, I have a handler module called from a PerlHandler My::Apache::Handler line in the httpd.conf file. That handler doesn't do much, as I've distilled it down to nothing during debugging:
If I comment out the $r->LOGGER line, it works OK, otherwise I get a "Can't locate object method" error.
Obviously, I'm not understanding either how to subclass an Apache::Request object properly, or my understanding on how mod_perl works is just not complete. Any ideas on what I'm doing wrong?
Update: Big thanks to everybody who's offered help on this one. I've learned so far that I have to unlearn everything I know about mod_perl. Maybe that will help me solve my problem. :)