in reply to Re^3: Perl OO and accessors
in thread Perl OO and accessors
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.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Perl OO and accessors
by Aristotle (Chancellor) on Nov 29, 2005 at 04:36 UTC | |
by sauoq (Abbot) on Nov 29, 2005 at 04:48 UTC | |
by fergal (Chaplain) on Nov 29, 2005 at 11:42 UTC | |
by sauoq (Abbot) on Nov 29, 2005 at 13:48 UTC | |
by fergal (Chaplain) on Nov 29, 2005 at 16:04 UTC | |
| |
by Aristotle (Chancellor) on Nov 29, 2005 at 06:21 UTC | |
by sauoq (Abbot) on Nov 29, 2005 at 04:43 UTC |