What you do with $c->set_area( -42 )?
Maybe I'm missing something. Say that I implemented set_area as
How do you do the same with an lvalue sub?sub set_area { my $self = shift; my $area = shift; die "Area must be non-negative." unless $area >= 0; # ... }
How do you go back and change the interface later to avoid set_foo methods?
You don't. But, that's okay because you never have a need to.
-sauoq "My two cents aren't worth a dime.";
In reply to Re^4: Perl OO and accessors
by sauoq
in thread Perl OO and accessors
by dragonchild
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |