Bob Showalter wrote:
Here's a better example of something that actually might serve a bit more purpose along with the error I'm getting for THIS
FWIW, That example works OK for me under Apache 1.3.31, mod_perl 1.29 when I run under Apache::Registry. I had to add a declaration for %somehash, but otherwise it runs without error. Is main.pl running under Apache::Registry, or is it a PerlHandler or some other type of handler?
It always makes me nervous to see assumptions about the current working directory in any web server stuff. You should code the full path to helper.pl, or better, create a proper module and pull it in with use.
particular example.
And yes, this is running under Apache::Registry:
test.pl: #!/usr/bin/perl use strict; use Apache::Constants qw(OK DECLINED SERVER_ERROR FORBIDDEN); use Apache::Cookie (); require('lib/helper.pl');
print "Content-type: text/html\n\n"; my $rand=&genrand(20); print "<html><body>$rand</body></html>";
helper.pl: sub genrand { my [EMAIL PROTECTED]; my $r; my @chars=('a'..'z','A'..'Z','0'..'9','_'); $r.=$chars[rand @chars] for(1..$l); return $r; }
1;
When running test.pl, I get the following in my logs:
Use of uninitialized value in foreach loop entry at lib/helper.pl line 4.
Use of uninitialized value in foreach loop entry at lib/helper.pl line 4.
Use of uninitialized value in concatenation (.) or string at /export/home/newsite/perl/test.pl line 10.
So, what I can gather is that the value '20' isn't being received by the genrand subroutine, and it's getting something else instead. What exactly, I'm not sure
but I know it has to do SOMETHING with Apache::Registry. To test things out, I went ahead and changed the genrand sub to spit out what it was receiving:
sub genrand { my @[EMAIL PROTECTED]; my $r; $r.="$_<br />\n" for @blah; return $r; }
What did it return? "20<br />"
Now how the hell that happened, I don't know, but it STILL isn't getting that value passed. Any idea what apache's sending here and why it doesn't want to
grab the variable?
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>