I'm just looking into CGI::Application, and after reading the pod and
viewing the code, I have two main questions...

(1) Should there be a NO_HEADERS and/or NO_OUTPUT (or similar) parameter
that the run() method takes? I ask for two reasons:

A. If I want to override the run method, for instance to print a
standard header/footer each time the app is run(), I would imagine that
it go like this:

  package My::App;
  use base 'CGI::Application';
  sub new {
    my $class = shift;
    my $s = $class->SUPER::new(@_);
    $s->param('header' => $s->load_tmpl('header_common.html'));
    $s->param('footer' => $s->load_tmpl('footer_common.html'));
    return $s;
  }
  sub run {
    my $s = shift;
    print $s->_send_headers(); # Shouldn't this be a public method?

     # Print the head template
    print $s->param('header');

     # Now call C::A's run method...
    $s->SUPER::run(NO_HEADERS=> 1);
     # or maybe...
    print $s->SUPER::run(NO_HEADERS=> 1, NO_OUTPUT => 1);
     # or even....
    $s->param('NO_HEADERS' => 1);
    $s->SUPER::run();
 
    # Now print the footer template
    print $s->param('footer');
  }

B. If I have a hierarchy of C::A objects, the second (or third, gasp)
won't need to print an HTTP header at all.


(2) Lastly, on the heels of #B above:

How do _you_ implement an app hierarchy?

An application has different modules (sectional groupings of
functionality.) Sales, Inventory, Reports, etc, each having it's own set
of run-modes, or even sub-modules with sub-run-modes. I'd like to use
the same URL for the whole shebang.

I envision the base app's run-mode being a param called "module" with a
value like "sales", then the base app can dynamically load the proper
'sub app' code and object, then that $subapp runs off with a second
traditional run-mode to do stuff.

Or should I just use run-mode values like: 
'Parts_Save' or 'Jobs_List' or 'Reports_JobTotals'
Then I could use $app->prerun() to trim off the first part, load the
specified code library, then run prerun_mode to save the trimmed run-mode
back to app object.

Am I way off base?

TIA

Sebastian


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.vm.com/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to