Hey guys,
mod_perl newbie here. Our web app was written a year ago as a regular
CGI. Now that it gets accessed close to 1000 times a day (business
grows) I saw the need to rewrite it using mod_perl2 as a "handler".
I'm trying to use mod_perl-2.0.2 and apache 2.0.55. There isn't much
documentation on mp2 as far as "what is right/standard" and google
hasn't been much help so I've come here.
I basically wanted to see if someone could 'glance over' my setup and
offer any pointers. Also, if there is any documentation on how to
correctly use Apache::DBI with mod_perl2 and apache2, that would be
great cause even though I'm "use Apache::DBI", my connections aren't
being cached.
Technically, everything works fine: no perl warnings, pages load
blazingly fast..except the DBI caching.
Thanks alot.
-Matthew
Here's in my httpd.conf:
--------------------------
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlRequire /home/someone/public_html/sec/startup.pl
<Location /sec/v2>
SetHandler perl-script
PerlResponseHandler someone::v2
</Location>
We make frequent modifications to the script so Apache2::Reload helps
keep us from having to restart apache each time.
My startup.pl
---------------------------
use CGI;
use Date::Format;
use HTML::Template;
use Time::HiRes qw(gettimeofday);
use Apache2::RequestRec();
use Apache2::RequestIO();
use Apache2::Const -compile => ':common';
use Apache2::Cookie();
use lib qw(/home/someone/public_html/sec/);
use Apache::DBI; // this aint working right
1;
And inside someone/v2.pm
------------------------------
package someone::v2;
use strict;
use warnings;
use Apache2::Reload;
use vars qw($q $r $dbh $template $sql);
sub handler {
$r = shift;
$q = CGI->new();
.. DBI init..Template init..
return Apache2::Const::OK;
}
..more subs..