Commit | Line | Data |
26164c8d |
1 | package Person; |
2 | |
3 | use Moose; |
4 | |
5 | with 'Printable', 'HasAccount', 'OutputsXML'; |
6 | |
7 | has title => ( |
8 | is => 'rw', |
9 | predicate => 'has_title', |
10 | clearer => 'clear_title', |
11 | ); |
12 | |
13 | has first_name => ( is => 'rw' ); |
14 | |
15 | has last_name => ( is => 'rw' ); |
16 | |
17 | sub 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 | |
27 | sub as_string { $_[0]->full_name } |
28 | |
26164c8d |
29 | no Moose; |
30 | |
31 | __PACKAGE__->meta->make_immutable; |
32 | |
33 | 1; |