in reply to Re^3: Scope::Upper localize?
in thread Scope::Upper localize?
With Guard, you get to set up a call back when the scope is left to clean up whatever.
For my purposes, the only work to be done at scope exit, is for the previous value of the localized variable to be restored.
All the work is in deriving the value(s) of the variable(s) that need localizing. A common pattern of boilerplate code needed at the *top* of many different scopes and so a candidate for wrapping up in a sub.
But with local you cannot localize variables in your caller. With localize() you can. And the only required clean up is taken care of by the normal scope clean up.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Scope::Upper localize?
by Corion (Patriarch) on Sep 11, 2012 at 20:11 UTC | |
by Anonymous Monk on Sep 11, 2012 at 20:54 UTC | |
by Corion (Patriarch) on Sep 11, 2012 at 21:00 UTC | |
by Anonymous Monk on Sep 11, 2012 at 21:14 UTC | |
by Corion (Patriarch) on Sep 11, 2012 at 21:24 UTC | |
|