in reply to 'local' for imported variables doesn't work as expected

TIMTOWTDI

instead of exporting the variable you can just check it directly in the caller's namespace. (If it even exists )

use v5.12; use warnings; BEGIN{ package log; our $var= "default"; sub tst { my $pkg= (caller)[0]; no strict 'refs'; say ${"${pkg}::var"} } # export *Other::tst = \&tst; } package Other; our $var = __PACKAGE__; { local $var = "foo"; tst(); } tst();

foo Other
This might give your debugging interesting options...

Update

An alternative to messing with strict refs is to explicitly dig thru the stashes...

say ${$::{"${pkg}::"}{"var"}};

... Tho beauty is in the eye of the beholder ;)

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery