summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games.pm
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-25 18:08:30 -0500
committerdoy <doy@tozt.net>2009-01-25 18:08:30 -0500
commitbc56156be1081cdd55ccc60d9dfb9d00b1c40ea7 (patch)
treefbff39d2f3d5046a6b33256de04f4dd0384cbec8 /lib/Bot/Games.pm
parent0442c25e47d2ead4534a80d10ca03462883bc6ff (diff)
downloadbot-games-bc56156be1081cdd55ccc60d9dfb9d00b1c40ea7.tar.gz
bot-games-bc56156be1081cdd55ccc60d9dfb9d00b1c40ea7.zip
defer make_immutable on Bot::Games::Game until after we have added the say method
Diffstat (limited to 'lib/Bot/Games.pm')
-rw-r--r--lib/Bot/Games.pm18
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm
index afba5b2..b3554e7 100644
--- a/lib/Bot/Games.pm
+++ b/lib/Bot/Games.pm
@@ -40,7 +40,8 @@ sub BUILD {
return $self->say(%$args, %overrides);
};
require Bot::Games::Game;
- _add_method('Bot::Games::Game', say => $say);
+ Bot::Games::Game->meta->add_method(say => $say);
+ Bot::Games::Game->meta->make_immutable;
}
sub said {
@@ -137,21 +138,6 @@ sub _get_command {
&& $method_meta->meta->does_role('Bot::Games::Meta::Role::Command');
}
-sub _add_method {
- my $class = shift;
- my ($name, $meth) = @_;
- return if ($class->meta->get_method($name));
- if ($class->meta->is_immutable) {
- my %immutable_opts = %{ $class->meta->get_immutable_options };
- $class->meta->make_mutable;
- $class->meta->add_method($name => $meth);
- $class->meta->make_immutable(%immutable_opts);
- }
- else {
- $class->meta->add_method($name => $meth);
- }
-}
-
__PACKAGE__->meta->make_immutable(inline_constructor => 0);
no Bot::Games::OO;