Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: How to best pass on the context / wantarray?

by Corion (Pope)
on Mar 27, 2006 at 06:01 UTC ( #539371=note: print w/ replies, xml ) Need Help??


in reply to Re: How to best pass on the context / wantarray?
in thread How to best pass on the context / wantarray?

Something like this was my first idea too, but that doesn't preserve the calling context - wantarray will always be defined in ->_get_self. jdporter's method would solve that problem of course, by inspecting the context one calling level higher.


Comment on Re^2: How to best pass on the context / wantarray?
Select or Download Code
Re^3: How to best pass on the context / wantarray?
by dragonchild (Archbishop) on Mar 27, 2006 at 11:43 UTC
    I don't think you want the calling context thing. I've been trying to figure out how I would use your proposed API and all it's doing is confusing me. Grandfather said it right.

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
Re^3: How to best pass on the context / wantarray? (know)
by tye (Cardinal) on Mar 27, 2006 at 16:52 UTC

    _get_self() doesn't need to have the same context as its caller, it just needs to know the context of its caller. So it is as simple as:

    my $self= shift(@_)->_get_self( wantarray );

    - tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2015-07-03 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (48 votes), past polls