perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kemin Zhou <>
Subject mod_perl and JavaScript
Date Thu, 08 Apr 2004 22:04:38 GMT
This is almost certainly caused by a bug in your perl code.  You are
probably unintentionally creating a closure.  If you post some code
here, we can help you spot the problem.

- Perrin
Earlier I posted a problem with HPPTD and mod_perl.
Thanks for Perrin's respons.  

Now I have the problem solved.
The bug is the classical problem with named subroutin inside another subroutine.

This is one shortcoming of mod_perl.  PHP would not have such a problem.

I was using the CGI object as a global variable

my $q = new CGI

do something ....

my $request = $q->param('request');
if ($request eq 'updateTable') {

sub updateDBTable {
	my $form_variable = $q->param('variable_name');

This code would have no problem at all if run as CGI script.
It it will be very bad under mod_perl.
So don't write this.  There are many solutions to this.

One of them is to pass $q as argument of the subroutine.  This is the one I used.

The problem looks as if a caching problem.  Because after the second run, the 
subroutine and the main program the $q-> will point to different forms.


Proprietary or confidential information belonging to Ferring Holding SA or to one of its affiliated
companies may be contained in the message. If you are not the addressee indicated in this
message (or responsible for the delivery of the message to such person), please do not copy
or deliver this message to anyone. In such case, please destroy this message and notify the
sender by reply e-mail. Please advise the sender immediately if you or your employer do not
consent to e-mail for messages of this kind. Opinions, conclusions and other information in
this message represent the opinion of the sender and do not necessarily represent or reflect
the views and opinions of Ferring.

Report problems:
Mail list info:
List etiquette:

View raw message