Alex,
check out http://perl.apache.org/guide/obvious.html#my_scoped_variable_in_nested_s
Cheers,
-Christoph
Alex Krohn wrote:
>
> Hi,
>
> I've read through the guide, and tried to search through the list, but
> CGI.pm is a pretty common keyword, ;). This script which I thought
> should work fine under mod_perl using Apache::Registry doesn't:
>
> #!/usr/local/bin/perl
> # ----------------------------------------------------------------
> use CGI;
> use strict;
> my $in = new CGI;
> print $in->header();
> print "Init Value: ", $in->param('val'), "\n";
> &foobar();
>
> sub foobar {
> print "Sub Value: ", $in->param('val'), "\n";
> }
> # ----------------------------------------------------------------
>
> I then run a couple times from the web test.cgi?val=a, test.cgi?val=b,
> etc. When I hit 6, 7 times things start getting strange (i.e. all the
> children have loaded the script). I then get:
>
> Init Value: a Sub Value: b
>
> Or, calling $in->param in one part of the script won't give you the same
> value as another part. I'm using:
>
> Apache 1.3.6
> mod_perl 1.19
> CGI.pm 2.53
> perl 5.005_02
>
> However, if I do:
>
> #!/usr/local/bin/perl
> # ----------------------------------------------------------------
> use CGI;
> use strict;
> my $in = new CGI;
> print $in->header();
> print "Init Value: ", $in->param('val'), "\n";
> &foobar($in);
>
> sub foobar {
> my $in = shift;
> print "Sub Value: ", $in->param('val'), "\n";
> }
> # ----------------------------------------------------------------
>
> The script works normally. I'm not quite sure what's going on. =) Have I
> just missed something obvious?
>
> Cheers,
>
> Alex
>
> -------------------- Gossamer Threads Inc. ----------------------
> Alex Krohn Email: [EMAIL PROTECTED]
> Internet Consultant Phone: (604) 687-5804
> http://www.gossamer-threads.com Fax : (604) 926-9320