You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Miroslav Madzarevic <mi...@sezampro.yu> on 2002/02/07 14:01:29 UTC

Subrequests

Is it possible that my perl script (Apache::Registry, Apache::PerlRun, 
HTML::Mason or whatever) could run multiple times with same parameters when the
user just invokes the URL once (for example clicks on <A> tag)  and if so how 
can I prevent this from happening.

I guess this is because of subrequests being fired and I _explicitly_ don't 
wish my code to run multiple times because strange things might happen.


Re: Subrequests

Posted by Pierre Phaneuf <pp...@nit.ca>.
Miroslav Madzarevic wrote:

> Is it possible that my perl script (Apache::Registry,
> Apache::PerlRun, HTML::Mason or whatever) could run multiple
> times with same parameters when the user just invokes the URL
> once (for example clicks on <A> tag)  and if so how can I prevent
> this from happening.

if(!$r->is_main()) {
  return;
}

-- 
Pierre Phaneuf

Re: Subrequests

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Thu, 7 Feb 2002, Miroslav Madzarevic wrote:

> Is it possible that my perl script (Apache::Registry, Apache::PerlRun, 
> HTML::Mason or whatever) could run multiple times with same parameters when the
> user just invokes the URL once (for example clicks on <A> tag)  and if so how 
> can I prevent this from happening.
> 
> I guess this is because of subrequests being fired and I _explicitly_ don't 
> wish my code to run multiple times because strange things might happen.

There are lots of ways of finding out what happens when a request comes in.
Read the debugging section of the mod_perl Guide: http://perl.apache.org/guide.
I favour tailing the error_log and printing truckloads of debug info in there
as a matter of routine.  (Amazing what you find, sometimes. :)

Browsers like Netscape can fire off lots of parallel requests.  You
might not expect them to do that.  Even if everything works like you
expect, if it runs on a Webserver how are you going to prevent people
double-clicking, or lots of people all clicking at once?  You'd better
fix your code so it can cope.

73,
Ged.