Build equivalent in Moose
package Person;
use Moose;
has name => (is => 'rw');
has age => (is => 'rw');
1;
- the 'is' keyword makes accessors
- is => 'rw'
- read/write attribute/method, method defaults to the attribute name
- writer => 'set_attribute'
- writer method name changed to set_attribute
- reader => 'get_attribute'
- reader method name changed to get_attribute
- is => 'ro'
- read only attribute/method, method defaults to the attribute name
- reader => 'get_attribute'
- reader method name changed to get_attribute