From cbec5ffe7b6364de7a6988518ac5be6c4d660325 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 1 Jun 2009 02:04:00 -0500 Subject: don't try to format last_turn_time if nobody has taken a turn yet --- lib/Bot/Games/Game.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 => ( -- cgit v1.2.3