Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: CGI::Application with 'main' runmodes and 'sub' runmodes

by derby (Abbot)
on Apr 28, 2007 at 12:43 UTC ( [id://612538]=note: print w/replies, xml ) Need Help??


in reply to CGI::Application with 'main' runmodes and 'sub' runmodes

Hmmm ... that exit at the end of each method is a real bad code smell. It may be perfectly okay but I think it would give most CGI::Application'ers pause.

Without knowing about your app, it's really hard to comment on your approach. For me, once the run modes start getting past a half-dozen or so, I start looking for ways to refactor. Either as other apps or by taking a hard look at my runmodes and deciding their not really runmodes but maybe differing views or differing model of a runmode -- moving those decisions further down into the controller.

-derby
  • Comment on Re: CGI::Application with 'main' runmodes and 'sub' runmodes

Replies are listed 'Best First'.
Re^2: CGI::Application with 'main' runmodes and 'sub' runmodes
by wfsp (Abbot) on Apr 28, 2007 at 12:55 UTC
    Thanks for your response.
    ...a real bad code smell.
    I agree. A previous 'refactoring' had each 'main runmode' take the second element of path_info and run it through a dispatch table. I just had the feeling that I could let C::A handle that too.

    My last effort was, as you say, to separate out the main runmodes as separate C::A apps each with its own instance script. I have a Base.pm that inits everything thats needed and all common code is in its own module. So perhaps the separate apps idea is the way to go.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://612538]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-23 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found