Not sure what Python is implementing with that pattern, but I know it doesn't have block-scope, OTOH nesting functions is easier there.
So many things which are
just blocks in Perl become named functions there, even lamda is useless for that.
But no need to copy their limitations.
My suggestion would be to apply attributes or explicit use
sub :test something {
my :TEMPDIR $tempdir = shift; # or
my :FIXTURE $tempdir = shift; # or
use fixture qw/$tempdir/;
#...
}
This offers plenty of possibilities at compile time and is more flexible than Python's approach.
edit
and I'd certainly put test-subs into their own package, if they lived in the same file.
|