Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: A general method of locally overriding subroutines

by tmoertel (Chaplain)
on Mar 11, 2006 at 16:56 UTC ( [id://535971]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://535971]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 05:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found