Redid the augment exercises and based it on a non-XML
[gitmo/moose-presentations.git] / moose-class / exercises / answers / 04-method-modifiers / Person.pm
CommitLineData
26164c8d 1package Person;
2
3use Moose;
4
5with 'Printable', 'HasAccount', 'OutputsXML';
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
26164c8d 29no Moose;
30
31__PACKAGE__->meta->make_immutable;
32
331;