CGI::Application with 'main' runmodes and 'sub' runmodesby wfsp (Abbot)
|on Apr 28, 2007 at 12:08 UTC||Need Help??|
wfsp has asked for the
wisdom of the Perl Monks concerning the following question:
I'm working on a CGI::App that is growing like topsy. The list of runmodes has past a dozen and is veering crazily toward two.
I hit some snags implementing it, here is what I finaly came up with.
Two.pm would be along similar lines. The instance script would be something like
will get us to 'main' runmode 'one', 'sub runmode' 'one_a'.
I'll now be able to develope/test each 'main runmode' separately and things should go more smoothly (I said 'should'!).
One point though, in Main.pm I've had to include exit; at the end of each method. Because of the way C::A works the header will have already been added/sent. Just having a return would mean another header would be added. Interestingly, $self->header('none') did what it says on the tin but tacked on the word 'none' to the end of the ouput (after, in this case, the closing html tag).
What do the monks think about the general approach? Worth pursuing or are there pitfalls and traps ahead?