in reply to How do I localize a value to the calling function's scope?

I think you're approaching the problem from the wrong angle. If you want to test each function in isolation (which is a good thing), have each function appear in isolation. For example, if you have your functions in a library that uses Exporter, provide a way to export each function by itself. If you have an object method, create an class (on-the-fly, perhaps) that inherits from the object you want to test and that overrides every other method, leaving you just the one method to test.

Either way you go about it, you now have the ability to create the appropriate stubs, either in the namespace you export into or in the class that inherits from the class you're testing.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

  • Comment on Re: How do I localize a value to the calling function's scope?