Ah Contextual::Return. I've had some interesting results with it in the past, as well as interesting feedback. It seems I went with Want in that case, though I don't have the foggiest clue what I was working on back then. But what do you think either module would get me, versus the basic approach (below)? I'm not sure how that would actually get me an overloaded result as you (I think) suggest, just a return based on different contexts?
wantarray ? (_special_to_string($arg), $arg) : _special_to_string($arg);
Remembering both string and special are both scalars (strings, in fact), how (in high level terms at least) would you tackle this with either C::R or Want?
In reply to Re^2: OO design: returning string and/or special value
by wanna_code_perl
in thread OO design: returning string and/or special value
by wanna_code_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |