You're thinking about this backwards. Instead of worrying about your class hierarchy from to top-down (base-to-child), worry about it from the perspective that you're developing at - from the bottom-up (child-to-base). Remember - CgiApp doesn't care about your base classes - it only cares about the leaves of your class tree. So, work with those as your "base" level. Then, build your classes-that-encapsulate-common-functionality from there.
So, create a base class called My::App::WithLogin that inherits from My::App::Base which provides a cgiapp_prerun that checks for being logged in. Then, have your areas that require authn to use that. If they require a different kind of login, create another base class that inherits form My::App::WithLogin called My::App::WithSpecialLogin.
Remember - nothing says that all your children have to inherit from the same base class. You can have a hierarchy of base classes for the leaves that are all at the same conceptual level.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
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.