Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Contextual::Return blocks: can they be made to return the actual result?

by moritz (Cardinal)
on Jul 13, 2013 at 13:54 UTC ( #1044156=note: print w/ replies, xml ) Need Help??


in reply to Contextual::Return blocks: can they be made to return the actual result?

In my opinion, the whole approach of Contextual::Return is misguided. Either return an object that has a rich API (so that you can use it as a string, for example. See overload), or let the caller tell you what kind of return value it wants.

Everything that goes beyond the simple void/scalar/list context distinction is guesswork, and guessing shouldn't be used for such fundamental things as return values.


Comment on Re: Contextual::Return blocks: can they be made to return the actual result?
Re^2: Contextual::Return blocks: can they be made to return the actual result?
by wanna_code_perl (Pilgrim) on Jul 13, 2013 at 15:31 UTC

    Agreed. Unfortunately, I went from "wow, this is cool!", to "how is this bit supposed to work?", to "how is any of this supposed to work?" Too bad, it's a module I really wanted to like.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044156]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-12-20 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (99 votes), past polls