in reply to Re^3: Is it possible to create a sub exclusive to a sub?
in thread Is it possible to create a sub exclusive to a sub?
You use %main::test. That that's the same as *main::test{HASH} and *main::test{CODE} happens to be defined doesn't make it any less of a global variable. At least if you're going to go that route, do it directly
use vars qw( %test ); # ... $test{localsub}->();
so that strict can catch your typos. (Though it still won't catch $test{lcoalsub}, as opposed to a lexical mistyped as $lcoalsub.) The way you wrote it deprives you of protection wholly.
Makeshifts last the longest.
|
|---|