in reply to Re: OO design: returning string and/or special value
in thread OO design: returning string and/or special value
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?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: OO design: returning string and/or special value
by Fletch (Bishop) on Oct 07, 2019 at 21:46 UTC | |
by wanna_code_perl (Friar) on Oct 07, 2019 at 22:31 UTC | |
by AnomalousMonk (Archbishop) on Oct 07, 2019 at 23:52 UTC |