Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: A general method of locally overriding subroutines

by Aristotle (Chancellor)
on Jul 19, 2006 at 05:34 UTC ( [id://562191]=note: print w/replies, xml ) Need Help??


in reply to A general method of locally overriding subroutines

Is it me, or did everyone miss the simplest approach?

sub localize_and_call_fn { my ( $locals, $fn, @args ) = @_; if( @$locals ) { my ( $sym, @local ) = @$locals; local *$sym = sub { "changed" }; @local ? localize_and_call_fn( \@local, $fn, @args ) : $fn->( +@args ); } }

Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-04-20 02:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found