Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

CGI::Application & automagic run-modes

by InfiniteLoop (Hermit)
on Jul 20, 2005 at 15:49 UTC ( [id://476542]=perlquestion: print w/replies, xml ) Need Help??

InfiniteLoop has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Monks,

Im working on adding new features to a database (mysql) driven web application. Im using CGI::Application and HTML::Template, in a MVC architecture.

While looking at the application, I found that there are few 'run-modes', which are common to most of the 'modules', such as:

  1. View List Screen
  2. View Create Screen
  3. View Edit Screen
I plan to avoid coding these common stuffs, by implementing these runmodes/methods, once, in a parent class. The parent class, with the help of an all-knowing model class, introspects the table and gets the data and fill these screens. All CGI's would inherit this parent class and automagically get these run modes.


I have looked at maypole, but unfortunately I cannot expend time on incorporating maypole into the application, yet. Also I have searched cpan, but didnt find any modules that does this job.

Are there any common strategies that I can use for such instances ?
Has any one implemented a similar solution ? (Im sure this is not new, all Im looking for is a diet maypole!)

Replies are listed 'Best First'.
Re: CGI::Application & automagic run-modes
by samtregar (Abbot) on Jul 20, 2005 at 15:56 UTC
    Are there any common strategies that I can use for such instances?

    I'm not sure what you're asking exactly but your plan seems sound to me, assuming your tables are relatively simple. What you're doing reminds me of a new module which I've been meaning to investigate: CGI::Application::Plugin::BREAD. If you're looking for general CGI::App examples you might take a look at CGI::Application::Framework or Krang.

    -sam

Re: CGI::Application & automagic run-modes
by waswas-fng (Curate) on Jul 20, 2005 at 16:00 UTC
    I have also done a lot of CGI::App webapps, I have recently moved on to Catalyst. You may want to take a look. It has a better base IMHO than CGI:A, meaning you dont have to do as much building from the ground up. It also has a pretty nice scaffolding system where it will create MVC classes for you based on database, or TT, etc. A slick article on it showing how easy it is to make a webapp is here...


    -Waswas
Re: CGI::Application & automagic run-modes
by perrin (Chancellor) on Jul 20, 2005 at 16:56 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-16 10:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found