diff options
author | Struan Donald <struan@exo.org.uk> | 2012-03-30 12:44:59 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-03-30 12:44:59 +0100 |
commit | 32a74ddaf0f203ef9c9a28dc08c650c643e09de1 (patch) | |
tree | 570694dd21f36b562d38e8d5e1ffd8ddc848c70b /perllib/FixMyStreet/DB/Result/User.pm | |
parent | ff3926d0599b90f05e12b949205d8cc6e35df3be (diff) |
add first name and last name boxes for bromley
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index 56d726a8d..7b0ffca73 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -172,4 +172,22 @@ sub belongs_to_council { return 0; } +=head2 split_name + + $name = $user->split_name; + printf( 'Welcome %s %s', $name->{first}, $name->{last} ); + +Returns a hashref with first and last keys with first name(s) and last name. +NB: the spliting algorithm is extremely basic. + +=cut + +sub split_name { + my $self = shift; + + my ($first, $last) = $self->name =~ /^(\S*)(?: (.*))?$/; + + return { first => $first, last => $last }; +} + 1; |