> Damian Conway writes:
   > >  pre mymethod : group("safe-coding practice") { @_ > 0 }
   > >  pre mymethod : group("debugging") { print @_, "\n"; }
   > 
   > Using these for lvalue subs doesn't give you the behaviour you want:
   > 
   >   sub foo :lvalue { $foo }
   >   post foo { die if $foo == 5 }
   > 
   >   eval {
   >     foo() = 5;
   >   };
   > 
   > Should not set the lvalue of foo to 5.  But you can't test for
   > bad values until after you've made the assignment.

Postconditions on lvalue subs are not tested until the end of the complete 
expression in which the sub is called.

Damian

Reply via email to