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

Hi,

I'm writing an Intranet system (basically Content Management) for a school, so that teachers can post content to subjects for students to browse. It's currently running as mod_cgi and uses MySQL databases. It runs very fast as it is, but there are some doubts lurking in my mind:

1. Is it a must to always run under mod_perl for web applications? Or should this be used only in very massive apps? (Note: I've used Perl for most of my work on the web and always had it running as mod_cgi).
2. If I decide to port this to mod_perl -Apache::Registry-eventually, won't I run into problems with scripts that read cookies?

Thanks,
Ralph.

Replies are listed 'Best First'.
Re: Porting to mod_perl questions
by Arunbear (Prior) on Jun 17, 2004 at 23:23 UTC
    1. No - if your web application is running quickly under a realistic load, then you don't need mod_perl.
    2. For parsing cookies, CGI.pm can still be used under Apache::Registry, or you can use the much faster Apache::Cookie.
    3. If you use CGI::Application to build your web app, it will be trivial to port it to Apache::Registry, should you reach a point where mod_cgi is no longer fast enough.
    :-)
Re: Porting to mod_perl questions
by William G. Davis (Friar) on Jun 18, 2004 at 11:17 UTC

    Cookies should pose no trouble at all.

    As Arunbear pointed out, you can still use CGI.pm and CGI::Cookie under mod_perl. There's also Apache::Cookie, which is part of the Apache request library and written in C, but CGI::Cookie still remains the preferred means of cookie manipulation because of its greater popularity (it comes with Perl) and its greater portability (Apache::Cookie, because of its C backend, didn't work on MacOS or Windows for quite a while. It might work on them now, but I'm not sure).

    Read the mod_perl porting guide: http://perl.apache.org/docs/1.0/guide/porting.html. It's really not that hard; just initializing your global variables and wraping your scripts in big main() routines.