Keep It Simple, Stupid | |
PerlMonks |
Re: Subclassing Apache::Request?by tadamec (Beadle) |
on Aug 11, 2004 at 19:41 UTC ( [id://382064]=note: print w/replies, xml ) | Need Help?? |
Thanks to everybody who's set my mind straight regarding mod_perl. I've discovered through this that subclassing the Apache::Handler isn't the best way to do this. I'm going to go back and rearchitect some of the main application to give me this functionality. None of the "action" objects of the app are decdendant classes, and the constructor for each of the classes are exactly the same, so that's where I'll put the magic in. I'll go back and write an "Action" object that the rest of the objects will use as a base class, and add methods to fiddle with the session for each object. The session will be passed to the constructor, as it is now, and I'll rewrite the per-object session manipulation to use new methods. This will allow me to emulate private namespaces within the session transparently by having the parent Action object interrogate who the caller is and create a "private" and "public" namespace that the default methods will deal with. All in all, it's not the solution I wanted, but I think it's the right one; Apache::Handler subclassing would have worked (if mod_perl worked the way I used to think it did :), but having application-type logic contained within the application, instead of the web server classes, makes for a more logical grouping of functions. Thanks again, everybody! I never would have seen this path if you weren't so patient in explaining why my world view was wrong.
In Section
Seekers of Perl Wisdom
|
|