Finished slides & exercises for section 3on basic attributes.
[gitmo/moose-presentations.git] / moose-class / exercises / answers / 03-basic-attributes / Employee.pm
CommitLineData
8d1ce1d7 1package Employee;
2
3use Moose;
4
5extends 'Person';
6
7has '+title' => (
8 default => 'Worker',
9);
10
11has salary_level => (
12 is => 'rw',
13 default => 1,
14);
15
16has salary => (
17 is => 'ro',
18 lazy => 1,
19 builder => '_build_salary',
20 init_arg => undef,
21);
22
23has ssn => ( is => 'ro' );
24
25sub _build_salary {
26 my $self = shift;
27
28 return $self->salary_level * 10000;
29}
30
31no Moose;
32
33__PACKAGE__->meta->make_immutable;
34
351;