in reply to juggling multiple CGI::Application subclasses

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:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re: juggling multiple CGI::Application subclasses