From 5575d6e66359f5231091a10c9f3169686ec23bd2 Mon Sep 17 00:00:00 2001 From: doy Date: Sun, 26 Apr 2009 23:44:22 -0500 Subject: make cmdlist return the list of command names, and turn the display logic into a formatter --- lib/Bot/Games/Game.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm index 7f68b71..8af0baf 100644 --- a/lib/Bot/Games/Game.pm +++ b/lib/Bot/Games/Game.pm @@ -76,8 +76,12 @@ command cmdlist => sub { if $method->meta->can('does_role') && $method->meta->does_role('Bot::Games::Trait::Method::Command'); } - return join ' ', sort map { '-' . $_ } @commands; -}, needs_init => 0; + return @commands; +}, needs_init => 0, + formatter => sub { + my $list = shift; + return join ' ', sort map { '-' . $_ } @$list + }; # XXX: this would be much nicer as an external module, but the only one that # really does what i want (DateTime::Format::Human::Duration) has only had one -- cgit v1.2.3-54-g00ecf