What you want is a pre-condition on the overridden assignment operator.

What you want to do may involve having the suggested transactional
variables.

<chaim>

>>>>> "NT" == Nathan Torkington <[EMAIL PROTECTED]> writes:

NT> Damian Conway writes:
>> pre mymethod : group("safe-coding practice") { @_ > 0 }
>> pre mymethod : group("debugging") { print @_, "\n"; }

NT> Using these for lvalue subs doesn't give you the behaviour you want:

NT>   sub foo :lvalue { $foo }
NT>   post foo { die if $foo == 5 }

NT>   eval {
NT>     foo() = 5;
NT>   };

NT> Should not set the lvalue of foo to 5.  But you can't test for
NT> bad values until after you've made the assignment.

-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to