in reply to Re^4: Psychic Disconnect and Object Systems
in thread Psychic Disconnect and Object Systems
Now, the driver can drive the car, and that will cause the attribute to change,
No, not without an accessor it won't. Sorry, but in Moose you don't have that form of access control. Without accessors, the car won't be able to change the odometer either. Either you have methods to change the value or you don't.
package Car; use Moose; has odometer => ( is => 'ro' ); sub drive { my ($self, $distance) = @_; ...can't update odometer... } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Psychic Disconnect and Object Systems
by JavaFan (Canon) on Apr 18, 2011 at 23:30 UTC | |
by ikegami (Patriarch) on Apr 19, 2011 at 04:04 UTC | |
by BrowserUk (Patriarch) on Apr 19, 2011 at 00:11 UTC |