John Williams: # Personally, I hope they look like attributes. But if they # do, the perl5 # lvalue subs are not the way to do it. Why? Because an # lvalue sub returns # a lvalue which get set _after_ the sub returns. At that # point it is too # late for the sub to do anything useful with the new value.
You can do validation in Perl 5 with tied variables (I think), but that's a lot of effort. We could do something related to the old lvalue subs, with optional validation: #Just like Perl 5 method foo() is rw { return $.foo; } #A little different method bar() is rw($new_bar) { if(defined $new_bar) { #yeah, I know, what if $new_bar=undef--maybe exists? validate_bar($new_bar); #Throws an exception if invalid $.bar=$new_bar; } else { $.bar; } } --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen Configure) Wire telegraph is a kind of a very, very long cat. You pull his tail in New York and his head is meowing in Los Angeles. And radio operates exactly the same way. The only difference is that there is no cat. --Albert Einstein (explaining radio)