There is no reason that you could not use just simple CGI to do things that you can do with mod_perl. The only real difference is that mod_perl gives you a speed boost and easier access to apache's guts (rarely vital, often useful).

I would suggest though writing your CGI apps in such a way that if you do need to move over to mod_perl, or get the chance to, you can do it easily. Essentially avoid all global variables and put as much as you can into modules. If you use CGI::Application then this is done for you to a large extent. If you don't want to use CGI::Application you can still borrow the idea of having CGI scripts that look like this:

#!/usr/local/bin/perl use lib '/path/to/my/files/perl/'; use MyWebApp; MyWebApp->go();
As an added advantage you give away very little to bad guys if the see the source to your CGI script as all the sensitive bits are in the module.

As for database connections you will not be able to store them between requests but this is not likely to be a performance concern compared to other bottlenecks that exist (ie firing up perl each time) - worry about it if it becomes a problem.

Update: Changed 'rarely needed' to 'rarely vital' in first line to be more accurate.

--tidiness is the memory loss of environmental mnemonics


In reply to Re: What if mod_perl is not an option? by EvdB
in thread What if mod_perl is not an option? by kiat

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.