On Tue, Feb 27, 2001 at 10:50:26PM +1100, Ian Brayshaw wrote:
> Given the following lvalue subroutine
> 
>       sub mysub : lvalue {
>               $value;
>       }
> 
> is there any way for mysub() to be able to determine that it
> was called in an lvalue context?

Yeah there is, but you're not going to like it :-)

 .robin.

use v5.6;
use Inline C => <<NOMO;

U8 wantlvalue ()
{
  return cxstack[cxstack_ix].blk_sub.lval;
}

NOMO

sub foo :lvalue {
  print (wantlvalue() ? "lvaluably\n" : "rvaluably\n");
  my $foo
}

foo();
foo() = 23;

Reply via email to