With Test::Most, you can do something like this:
ok $response = some_func($foo), 'some_func() should return something'
or show $response;
And if the test fails, the show() function should display something like:
# $response = 0;
However, if $response is actually a package variable, you would get:
# $VAR1 = 0;
This is because show relies on Data::Dumper::Names and that, in turn, relies on PadWalker. So basically, I'm wondering how I know something is a package variable and how to (easily) find its name. The only thing which occurs to me offhand is to either programmatically fetch the names of Perl's special variables and see if $VAR1 is really one of those. That might catch many package variables (and other "strange" variables like @_?), but is that enough? When people declare their own package variables, is there any easy way for me to find and identify them short of walking symbol tables looking for them?
1. I've seen this done, but I can't recall how to do it.