You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "J. J. Horner" <jh...@2jnetworks.com> on 2000/11/29 20:44:17 UTC

cgi script vs mod_perl script

I have a script that uses some hash magic to set some variables.  It works well in normal mode, but
when I put it in my /perl directory, it stops working well.

The full script is included.  In the script, I set up a hash of variables->subroutines
so that when someone sets a variable, it calles a specific subroutine using
$hash{$value}->()

It doesn't seem to work.

Any ideas?


-- 
J. J. Horner
jjhorner@bellsouth.net

"The people who vote decide nothing.
The people who count the vote decide everything."
	- Josef Stalin

"The tree of liberty must be watered periodically with the 
blood of tyrants and patriots alike. ... Resistance to tyrants
is obedience to God."
	- Thomas Jefferson

Re: cgi script vs mod_perl script

Posted by Benjamin Trott <be...@rhumba.pair.com>.
> The full script is included.  In the script, I set up a hash of
> variables->subroutines
> so that when someone sets a variable, it calles a specific subroutine using
> $hash{$value}->()
> 
> It doesn't seem to work.
> 
> Any ideas?

You didn't explicitly say what "doesn't work" about it, but it sounds like
the my scope variable problem described here:

    http://perl.apache.org/guide/perl.html#my_Scoped_Variable_in_Nested_S

You should either pass arguments/return values or declare your variables
using 'our' or 'use vars'.

bye,
Benjamin Trott