Hi,
I'm trying to port a system to mod_perl. Basically, I've got a 'global.pl' script that I require() from my other scripts to load functionality such as cookies, DB connections, etc. This is an extract of my global.pl file:#!/usr/bin/perl use DBI; use CGI; use Image::Size; sub env() { $query = $ENV{'QUERY_STRING'}; $cookie = $ENV{'HTTP_COOKIE'}; ($cookiename,$cookievalues) = split(/=/,$cookie); ($cookietype,$cookieuser) = split(/\&/,$cookievalues); $imgpath = "/home/e-smith/files/ibays/Primary/html/departments"; $imgpathweb = "/departments"; } sub form_read() { $q = new CGI; %fr = (); foreach ($q->param()) { $fr{$_} = $q->param($_); } } sub mysql_connect() { $dbh = DBI->connect("dbi:mysql:departments","user","passwd") or die "S +QL Connection Error."; }
So then, from my CGI scripts I can do the following:
#!/usr/bin/perl require '../global/global.pl'; &env(); &mysql_connect(); $sth = $dbh->prepare("select label,notes from departments where depart +ment='$query'"); $sth->execute; ($departmentlabel,$departmentnotes) = $sth->fetchrow_array; $sth->finish; $dbh->disconnect; &form_read(); print $fr{aformfield};
This all runs just fine as plain CGI, but starts crashing under Apache::Registry. Every a couple of reloads, I get an Internal Server Error, and in Apache's error log:
Undefined subroutine &Apache::ROOTdepartments::mod_2dperl::site::department_2epl::env ....
I tried searching the web for solutions, but the information I found is a little confusing.
Anyone knows what should be changed within the code above so that it runs correctly with Apache::Registry?
Any help is really appreciated.
Thanks,
Ralph
In reply to Porting to mod_perl issues by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |