http://qs321.pair.com?node_id=535971


in reply to Re: A general method of locally overriding subroutines
in thread A general method of locally overriding subroutines

I had tried the hash-slice method earlier, but it did not work when local-ized:
sub localize_and_call_fn { my ($locals, $fn, @args) = @_; local @::{@$locals} = (sub {"changed"}) x @$locals; $fn->(@args); }
I figured I was doing something wrong, but I couldn't figure out where exactly the train had left the rails. Thanks for putting more light on the subject.

Cheers,
Tom