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


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

That's a really neat way to do it. I used a similar technique for File::pushd -- using an object to enact a localized change that is reverted when the object goes out of scope.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

  • Comment on Re^2: A general method of locally overriding subroutines

Replies are listed 'Best First'.
Re^3: A general method of locally overriding subroutines
by fizbin (Chaplain) on Mar 18, 2006 at 01:48 UTC
    Isn't it nice to have deterministic behavior that fires when an object goes out of scope? I miss that when working in java.
    --
    @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/