Michael Peters wrote:
Brian Gaber wrote:
Using $q was not successful.
That's because you ignored my advice :)
Here is what I have done:
use vars qw($q);
That makes $q a global. Bad, bad, very bad. Slap yourself on the wrist.
Remove
that "use vars" line.
I don't see what is so bad about this:
use vars qw($q);
$q = CGI->new();
Even though it's a global variable, you are assigning it a new value,
CGI->new, each time.
On the other hand, a subroutine should never use a lexical variable that was
declared outside of it, at least not in a Registry type script because of
the nested subroutines. So this is very bad and should trigger a "variable
will not stay shared" warning:
my $q = CGI->new;
sub dostuff {
print $q->param('foobar');
}
I suspect the problem is something else, possibly part of the script that we
haven't seen.