Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

$this was a typo; should have been $self.

In the example, SiteManager isn't dispatching sub-requests; I should have used different names than those you'd given. I was considering the modules that SiteManager might load being not additional CGI::Application modules or modules that create output but API level things -- grabbing events for a calendar that needs to be displayed on every page, or a site navigation that needs to be custom generated on each page.

You can still have a single page that your client can bookmark, but this might be more of a homepage with links to other applications. The applications would all inherit from SiteManager so that you get:

  • Centralized authentication
  • Centralized navigation
  • Sitewide template shell
  • etc.

Another possibility would be to have an application that would dynamically instantiate and run() other CGI::Applications:

package SiteManager; use base qw/CGI::Application/; use EventManager; use EmailManager; sub setup { $self = shift; $self->run_modes( 'events' => 'events', 'email' => 'email ); } sub events { $self = shift; # Initialize a params hash or grab it from a config file and t +hen... $events = new EventManager($params); $events->run(); } sub email { $self = shift; # Initialize a params hash or grab it from a config file and t +hen... $email = new EmailManager($params); $email->run(); }

However, even with this example, it might not be a bad idea to have a base class that takes care of authentication, site template, etc.


In reply to Re^3: CGI::Application, inheritance trees, and 'the right way' by weierophinney
in thread CGI::Application, inheritance trees, and 'the right way' by geektron

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-29 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found