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 reply to Re: Subclassing Apache::Request? by tadamec
in thread Subclassing Apache::Request? by tadamec

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.