hesco has asked for the wisdom of the Perl Monks concerning the following question:

OK folks, here's a stumper. Anyone here have any idea why __these__ errors:

"my" variable $title masks earlier declaration in same statement at t/ +dpr_functions.t line 298. "my" variable $moreinfo masks earlier declaration in same statement at + t/dpr_functions.t line 298. "my" variable $contacts masks earlier declaration in same scope at t/d +pr_functions.t line 300. "my" variable $title masks earlier declaration in same scope at t/dpr_ +functions.t line 300. etc., . . .
gets returned for these lines:

298 print STDERR "$title\n$moreinfo\n"; 300 return($releasedate,$contacts,$title,$subtitle,$body,$moreinfo);
In the past, I've only seen this error when I try to re-initialize a variable I've already seen in the same block. What is this about? -- Hugh

UPDATE wazooks: You may be on to something there. Modperl is installed here. I bypassed the errors, by returning a hash instead of an array. Not sure what that was about, but am grateful that TIMTOWTDI. Kept me moving.

Replies are listed 'Best First'.
Re: Stumped by error message
by wazoox (Prior) on Mar 11, 2006 at 20:48 UTC
    Are you by any chance running this with mod_perl ? mod_perl generate very strange side-effects with code and variables that appear to be in the main package.
Re: Stumped by error message
by clinton (Priest) on Mar 12, 2006 at 01:58 UTC
    Likeliest things is you have unbalanced parentheses or brackets, for instance:
    If ($foo->('bar') {
    If you have corrected it by changing an array to a hash, then probably you have just eliminated the unbalanced bracket somewhere.
Re: Stumped by error message
by spiritway (Vicar) on Mar 11, 2006 at 20:53 UTC

    I don't see anything in the code you present that would account for that. Can you try to whittle down the full script until it's as small as possible, while still creating these errors? Doing that might help you see where things go wrong; if not, you can post a smaller amount of code for others to look at.

    My initial guess - and it's only a guess - is that somewhere along the line, the compiler gets confused and starts emitting erroneous error messages.