in reply to Contextual::Return blocks: can they be made to return the actual result?
No; Contextual::Return always returns a Contextual::Return::Value object in scalar context. That's part of the mechanism that allows it to work; when the function is running it can't predict, say, whether the result will be used as a string or a boolean, so it returns an object that overloads both.
If $foo is an object, you shouldn't be peeking at $foo->{name} anyway; write an accessor so that you can do $foo->name.
If you're after wantarray-on-crack, then Want might be more to your liking.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Contextual::Return blocks: can they be made to return the actual result?
by wanna_code_perl (Friar) on Jul 14, 2013 at 03:00 UTC |