added exercises for part 5
[gitmo/moose-presentations.git] / moose-class / exercises / answers / 03-basic-attributes / Person.pm
CommitLineData
8d1ce1d7 1package Person;
2
3use Moose;
4
5with 'Printable', 'HasAccount';
6
7has title => (
8 is => 'rw',
9 predicate => 'has_title',
10 clearer => 'clear_title',
11);
12
13has first_name => ( is => 'rw' );
14
15has last_name => ( is => 'rw' );
16
17sub full_name {
18 my $self = shift;
19
20 my $title = join q{ }, $self->first_name, $self->last_name;
21 $title .= q[ (] . $self->title . q[)]
22 if $self->has_title;
23
24 return $title;
25}
26
27sub as_string { $_[0]->full_name }
28
29no Moose;
30
31__PACKAGE__->meta->make_immutable;
32
331;