The Want module is quite interesting, but seems a little awkward in terms of implementation. Here's an example:
use Want;
sub fooz : lvalue
{
defined ($foo_new)?
$foo_new
: (want('LVALUE','ASSIGN')?
$foo_new = $foo
: $foo);
}
Internally, there is a function from the Wait.xs component called 'want_lvalue', which is really all I need. If it were assigned a default parameter value (it relates to stack depth) then it could be used like so:
use Want;
sub fooz : lvalue
{
defined ($foo_new)?
$foo_new
: want_lvalue?
$foo_new = $foo
: $foo);
}
This does seem to be a lot neater, though not currently implemented.
It just goes to show that CPAN has a module for every occasion. I wouldn't be surprised to see Cheese::Grater.
Thanks for the tip. It's exactly what I was looking for. | [reply] [d/l] [select] |