Update: this bug has now been fixed for perl-5.10 (change #27547), and I think it is likely the fix will make it into one of the next maintenance releases (5.8.9 or 5.8.10) as well.
So you will be able to write:
sub localise_and_call { my($fn, @args) = @_; my $stash = \%::; # assuming main package local @$stash{@args} = (sub { "changed" }) x @args; $fn->(@args); }
Hugo
In reply to Re^2: A general method of locally overriding subroutines
by hv
in thread A general method of locally overriding subroutines
by tmoertel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |