diff options
author | doy <doy@tozt.net> | 2009-01-15 01:09:43 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-01-15 01:09:43 -0500 |
commit | 91161b518ac8858899717a785cb3443b695f8a5f (patch) | |
tree | 24a1d004e11a41ba879800349b4c0e413d007ab1 | |
parent | 16612c204ffde260a58ef51085fc1343505aa246 (diff) | |
download | bot-games-91161b518ac8858899717a785cb3443b695f8a5f.tar.gz bot-games-91161b518ac8858899717a785cb3443b695f8a5f.zip |
syntax fixes
-rw-r--r-- | lib/Bot/Games/Game/24.pm | 4 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Ghost.pm | 2 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Ghostlike.pm | 10 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Spook.pm | 8 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Superghost.pm | 2 | ||||
-rw-r--r-- | lib/Bot/Games/Game/Xghost.pm | 2 | ||||
-rw-r--r-- | lib/Bot/Games/Meta/Role/Command.pm | 4 | ||||
-rw-r--r-- | lib/Bot/Games/OO.pm | 2 |
8 files changed, 17 insertions, 17 deletions
diff --git a/lib/Bot/Games/Game/24.pm b/lib/Bot/Games/Game/24.pm index 039b551..cbe0edc 100644 --- a/lib/Bot/Games/Game/24.pm +++ b/lib/Bot/Games/Game/24.pm @@ -39,9 +39,9 @@ sub turn { else { return $eval; } -} +}; -command give_up => { +command give_up => sub { my $self = shift; $self->is_over($self->solution); return; diff --git a/lib/Bot/Games/Game/Ghost.pm b/lib/Bot/Games/Game/Ghost.pm index 1d65683..82baf3b 100644 --- a/lib/Bot/Games/Game/Ghost.pm +++ b/lib/Bot/Games/Game/Ghost.pm @@ -7,7 +7,7 @@ has '+help' => ( default => "ghost help", ); -command valid_move => { +command valid_move => sub { my $self = shift; my ($move) = @_; return uc(substr($move, 0, -1)) eq $self->state; diff --git a/lib/Bot/Games/Game/Ghostlike.pm b/lib/Bot/Games/Game/Ghostlike.pm index e6bad0e..5337760 100644 --- a/lib/Bot/Games/Game/Ghostlike.pm +++ b/lib/Bot/Games/Game/Ghostlike.pm @@ -73,7 +73,7 @@ sub turn { return $self->state($state); } -command challenge => { +command challenge => sub { my $self = shift; my ($word, $args) = @_; my $player = $args->{player}; @@ -101,21 +101,21 @@ command challenge => { } }; -command previous_player => { +command previous_player => sub { my $self = shift; return unless $self->has_current_player; return $self->players->[$self->current_player_index - 1]; }; -command next_player => { +command next_player => sub { my $self = shift; return unless $self->has_current_player; return $self->players->[($self->current_player_index + 1) % $self->num_players]; }; -command valid_move => { 1 }; +command valid_move => sub { 1 }; -command valid_word_from_state => { +command valid_word_from_state => sub { my $self = shift; my ($word) = @_; return uc($word) eq $self->state; diff --git a/lib/Bot/Games/Game/Spook.pm b/lib/Bot/Games/Game/Spook.pm index 2ec4e2e..5780953 100644 --- a/lib/Bot/Games/Game/Spook.pm +++ b/lib/Bot/Games/Game/Spook.pm @@ -8,20 +8,20 @@ has '+help' => ( default => "spook help", ); -command valid_move => { +command valid_move => sub { my $self = shift; my ($move) = @_; return is_subpermutation($self->state, uc($move)) && length($self->state) + 1 == length($move); -} +}; -command valid_word_from_state => { +command valid_word_from_state => sub { my $self = shift; my ($word) = @_; $word = uc join '', sort split(//, $word); my $state = join '', sort split(//, $self->state); return $word eq $state; -} +}; __PACKAGE__->meta->make_immutable; no Bot::Games::OO; diff --git a/lib/Bot/Games/Game/Superghost.pm b/lib/Bot/Games/Game/Superghost.pm index f6a4d7b..df297ee 100644 --- a/lib/Bot/Games/Game/Superghost.pm +++ b/lib/Bot/Games/Game/Superghost.pm @@ -7,7 +7,7 @@ has '+help' => ( default => "superghost help", ); -command valid_move => { +command valid_move => sub { my $self = shift; my ($move) = @_; return uc(substr($move, 0, -1)) eq $self->state diff --git a/lib/Bot/Games/Game/Xghost.pm b/lib/Bot/Games/Game/Xghost.pm index 8f9092d..0c44cff 100644 --- a/lib/Bot/Games/Game/Xghost.pm +++ b/lib/Bot/Games/Game/Xghost.pm @@ -8,7 +8,7 @@ has '+help' => ( default => "xghost help", ); -command valid_move => { +command valid_move => sub { my $self = shift; my ($move) = @_; return is_substring($self->state, uc($move)) diff --git a/lib/Bot/Games/Meta/Role/Command.pm b/lib/Bot/Games/Meta/Role/Command.pm index 84abfa8..9be0a22 100644 --- a/lib/Bot/Games/Meta/Role/Command.pm +++ b/lib/Bot/Games/Meta/Role/Command.pm @@ -8,11 +8,11 @@ has pass_args => ( default => 1, ); -around execute => ( +around execute => sub { my $orig = shift; my $self = shift; return $self->pass_args ? $orig->$self(@_) : $orig->$self(); -); +}; __PACKAGE__->meta->make_immutable; no Moose::Role; diff --git a/lib/Bot/Games/OO.pm b/lib/Bot/Games/OO.pm index b1f6a11..8401b47 100644 --- a/lib/Bot/Games/OO.pm +++ b/lib/Bot/Games/OO.pm @@ -5,7 +5,7 @@ use Moose::Exporter; use Bot::Games::Meta::Class; -sub command($&) { +sub command { my $class = shift; my ($name, $code) = @_; my $method_meta = Bot::Games::Meta::Method::Command->wrap( |