in reply to Re^2: can sub check context for lvalue vs rvalue context?
in thread can sub check context for lvalue vs rvalue context?

Of course if you want to do something contingent on value change...then it seems perl only offers a tied-type solution.

The documentation Lvalue subroutines does make a reference to Sentinel, which, from a quick look at the docs, appears to implement something like a tied scalar, in XS.

The tied scalar solution appears to already have been implemented with Sub::Lvalue, and in fact a search for "lvalue" on CPAN will show that the wheel has been reinvented several times, including making object accessors lvalues. One of the most comprehensive ones appears to be Contextual::Return (which implements its LVALUE/RVALUE blocks using tied scalars, too).

Replies are listed 'Best First'.
Re^4: can sub check context for lvalue vs rvalue context?
by LanX (Saint) on May 09, 2018 at 10:43 UTC
    The perldocs mention Sentinel?

    Now I'm considering writing a POD differ who shows me all perldoc differences for new versions once per year... ;-)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Wikisyntax for the Monastery