|Syntactic Confectionery Delight|
Variable "%data" is not availableby Hue-Bond (Priest)
|on Mar 21, 2011 at 20:30 UTC||Need Help??|
Hue-Bond has asked for the
wisdom of the Perl Monks concerning the following question:
I'm finding the uncommon error Variable "%data" is not available when using the following module:
As a workaround, it's enough to uncomment any of the commented lines (although the first of them triggers the expected warning):
At this point I checked perldiag, which says: "This can happen for one of two reasons. First, the outer lexical may be declared in an outer anonymous subroutine that has not yet been created. [...] The second situation is caused by an eval accessing a variable that has gone out of scope".
To me, this scenario isn't covered by either of the given explanations. I could be led to believe that the first of the reasons explains it, although then I'd like to be educated on how this module compares to an anonymous subroutine regarding the compilation-time vs run-time issues that are detailed in the documentation and result in this error.
Just for fun, I appended the following at the bottom of Foo.pm:
Then, running perl Foo.pm works fine even with all those 5 lines mentioned above commented out.