diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:04:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-06-01 02:04:00 -0500 |
commit | cbec5ffe7b6364de7a6988518ac5be6c4d660325 (patch) | |
tree | 0b15bce37b9427b845947a2659b67f069e0b0016 | |
parent | e68921f423402cf9e128610dcc1556d72a448fad (diff) | |
download | bot-games-cbec5ffe7b6364de7a6988518ac5be6c4d660325.tar.gz bot-games-cbec5ffe7b6364de7a6988518ac5be6c4d660325.zip |
don't try to format last_turn_time if nobody has taken a turn yet
-rw-r--r-- | lib/Bot/Games/Game.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm index 088a906..c8641a4 100644 --- a/lib/Bot/Games/Game.pm +++ b/lib/Bot/Games/Game.pm @@ -53,7 +53,11 @@ has last_turn_time => ( is => 'rw', isa => 'DateTime', command => 1, - formatter => sub { _diff_from_now(shift) }, + formatter => sub { + my $time = shift; + return "Nobody has taken a turn yet!" if !$time; + return _diff_from_now($time) + }, ); has is_active => ( |