in reply to Short invocation for per-object methods
You did all this to avoid typing a couple of arrows? I think your lazy-meter is going in the wrong direction here.
In short, putting an object into a global variable is only a good idea if you want a singleton. Also, use of local() is kind of a last resort these days. I use it in a couple of situations where it's dramatically easier than the alternative, but there aren't many of those. It's likely to trip you up at some point.
You could easilly simplify to $self->debug($text) with no risk, just by making a debug() method that calls $self->{'debug'}. If you really want the debug code ref to differ by object, that's as good as you're likely to get without doing risky things.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Short invocation for per-object methods
by Crackers2 (Parson) on Jan 04, 2007 at 06:56 UTC | |
by perrin (Chancellor) on Jan 04, 2007 at 15:45 UTC | |
by ikegami (Patriarch) on Jan 04, 2007 at 16:37 UTC | |
by perrin (Chancellor) on Jan 04, 2007 at 16:47 UTC |