in reply to Re: Is there a wantobject like wantarray?
in thread Is there a wantobject like wantarray?

I think that's more or less how want works , it returns an object¹ which unfolds according to the context.

But I have to admit I never delved too deep into this area of Damian's creativity. :)

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

¹) or tied value? (which is actually not very different)

update

should be mentioned that this comes with a performance penalty, because even simple scalars need to be "unfolded".

  • Comment on Re^2: Is there a wantobject like wantarray?

Replies are listed 'Best First'.
Re^3: Is there a wantobject like wantarray?
by tobyink (Canon) on Sep 26, 2014 at 00:31 UTC

    No, Want isn't even Damian's module. I think you may be thinking of Contextual::Return. Want is far more spooky than that. It examines the OP tree to figure out how the return value is going to be used.

      Oops!

      I read the authors section too quickly, saw Damian's name and thought he gave up maintenance.

      Sorry! :)

      But inspecting the OP tree of the caller? That's possible ?

      Interesting!

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

        "But inspecting the OP tree of the caller? That's possible ?"

        Yeah, it's easy peasy. You just do this. ;-)