From 5af5428d564bb0c0748ddac21fa5823c1c19f965 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 31 Oct 2009 15:25:24 -0500 Subject: remove mx-ah --- dist.ini | 1 - lib/Bot/Games/Game.pm | 25 ++++++++++--------------- lib/Bot/Games/Game/Chess.pm | 6 +++--- lib/Bot/Games/OO.pm | 1 - lib/Bot/Games/OO/Role.pm | 1 - 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/dist.ini b/dist.ini index 56a947e..3d6f947 100644 --- a/dist.ini +++ b/dist.ini @@ -12,7 +12,6 @@ IM::Engine::Plugin::Commands = 0 DateTime = 0 Math::Expression::Evaluator = 0 Module::Pluggable = 0 -MooseX::AttributeHelpers = 0.18_01 Moose = 0.64 List::Util = 1.05 Games::Word = 0.04 diff --git a/lib/Bot/Games/Game.pm b/lib/Bot/Games/Game.pm index a9d0862..651a180 100644 --- a/lib/Bot/Games/Game.pm +++ b/lib/Bot/Games/Game.pm @@ -2,31 +2,26 @@ package Bot::Games::Game; use Bot::Games::OO; use DateTime; use Time::Duration; +use List::MoreUtils qw(any); has players => ( - traits => ['MooseX::AttributeHelpers::Trait::Collection::Array'], + traits => [qw(Array)], is => 'ro', isa => 'ArrayRef[Str]', auto_deref => 1, default => sub { [] }, - provides => { - push => 'add_player', - count => 'num_players', - }, - curries => { - find => { - has_player => sub { - my $self = shift; - my $body = shift; - my ($player) = @_; - return $self->$body(sub { $_[0] eq $player }) ? 1 : 0; - }, - }, + handles => { + add_player => 'push', + num_players => 'count', }, command => 1, ); command 'num_players'; -command 'has_player', formatter => 'Bool'; +command has_player => sub { + my $self = shift; + my ($player) = @_; + return any { $_ eq $player } $self->players; +}, formatter => 'Bool'; has start_time => ( is => 'ro', diff --git a/lib/Bot/Games/Game/Chess.pm b/lib/Bot/Games/Game/Chess.pm index c3eb14f..d689785 100644 --- a/lib/Bot/Games/Game/Chess.pm +++ b/lib/Bot/Games/Game/Chess.pm @@ -17,12 +17,12 @@ has game => ( ); has turn_count => ( - traits => ['MooseX::AttributeHelpers::Trait::Counter'], + traits => [qw(Counter)], is => 'ro', isa => 'Int', default => 1, - provides => { - inc => 'inc_turn', + handles => { + inc_turn => 'inc', } ); diff --git a/lib/Bot/Games/OO.pm b/lib/Bot/Games/OO.pm index 119718d..0131a1a 100644 --- a/lib/Bot/Games/OO.pm +++ b/lib/Bot/Games/OO.pm @@ -1,6 +1,5 @@ package Bot::Games::OO; use IM::Engine::Plugin::Commands::OO (); -use MooseX::AttributeHelpers; use Moose::Exporter; Moose::Exporter->setup_import_methods( diff --git a/lib/Bot/Games/OO/Role.pm b/lib/Bot/Games/OO/Role.pm index 43bcf4f..22ee5c0 100644 --- a/lib/Bot/Games/OO/Role.pm +++ b/lib/Bot/Games/OO/Role.pm @@ -1,6 +1,5 @@ package Bot::Games::OO::Role; use IM::Engine::Plugin::Commands::OO::Role (); -use MooseX::AttributeHelpers; use Moose::Exporter; Moose::Exporter->setup_import_methods( -- cgit v1.2.3