My reason for using CGI::Application also stems from trying to follow the MVC pattern. CGI::Application acts as the Controller and suggests using HTML::Template for the Views (although many people use TT in place of H::T). For the Model I usually create Class::DBI modules of my tables and litter them with many helper functions.

The other reason why CGI::Application is so good to use with mod_perl is that the actual CGI script is very small. All of the code is put into modules. The reason this is important when using mod_perl is explained by tilly's comment above. The actual CGI script is only a couple of lines long and hence you will not have problems with the "Cannot stay shared" issues that many legacy CGI scripts suffer from.

I'm not trying to turn this into a 'My Way is better than Your Way". But something you should get out of this, is that it is very beneficial to place the majority of your code into modules instead of building a monolithic script littered with functions, especially when you are using mod_perl.

- Cees


In reply to Re: Re: Re: thinking about mod_perl by cees
in thread thinking about mod_perl by geektron

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.