I was once told that in order for mod_perl CGI code to
work properly all functionality/logic needed to reside
in a function named "init()". Now that I'm pouring over
mod_perl documentation & getting things running, I haven't
found any mention of this.

So ... is there any special purpose w/in mod_perl for "sub init"?
or is it just a common naming convention?
or is it baloney?

Example:
----------------------------------------------------------------------
#!/usr/local/bin/perl

use CGI;
use HTML::Template;
use DButils;            # custom DB wrapper mod
use strict;

use vars qw($cgi, $dbh);
$cgi = new CGI;
$dbh = &DButils::loginDB;

&init();

&DButils::logoutDB($dbh);

####################
sub init {

        my $template = HTML::Template->new(filename => "template.html",
                                           global_vars => "1",
                                           cache => "1");

        # ... blah, blah, blah ...

        print $cgi->header;
        print $template->output;

        return 1;

}
----------------------------------------------------------------------

Thanks,
- Mark
  www.fantasycup.com
----------------------------------------

Reply via email to