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.

Replies are listed 'Best First'.
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 (Sage) 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