In general seperating concerns (your second aproach) is the appropriate way to do this--what makes mod_perl so cool is that you can hook into different phases of the Apache process! (ie. you can validate input, use access control, authenticate, and authorize all in distinct modules.) However, the appropriate approach is determined also by the current state of your code. For instance, if you are using AuthenHandlers, then use an AuthzHandler; however, if you're migrating your code (and using Apache::PerlRun or the like) then I wouldn't worry about seperating concerns.
Moreover, it depends on how concerned you are with speed; with regards to your final solution, I agree that restarting Apache so often may not be the best aproach--however, perhaps, if you put PerlCode into the Apache config file you could somehow finagle something? For instance, by having a requires statement that calls code, like what's in the Mod_perl book. I'm not exactly sure if this aproach would work, so somebody more experienced with the language should feel free to pipe up!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.