This is a good guess, and I think it's noteworthy that this happens even if the variable appears to be being set before use Module:
$ perl -I. -wMstrict -le '$Module::configvar=1; use Module; Module::menu();' in Module: false in menu(): true
Because use gets run in an implicit BEGIN block, so the code in Module.pm will always be executed before the code that sets $Module::configvar=1;. One solution is to say BEGIN { $Module::configvar=1; } before use Module;.
In reply to Re^2: package variable does not persist
by haukex
in thread package variable does not persist
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |