summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games/OO/Game.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bot/Games/OO/Game.pm')
-rw-r--r--lib/Bot/Games/OO/Game.pm65
1 files changed, 0 insertions, 65 deletions
diff --git a/lib/Bot/Games/OO/Game.pm b/lib/Bot/Games/OO/Game.pm
deleted file mode 100644
index 5820b80..0000000
--- a/lib/Bot/Games/OO/Game.pm
+++ /dev/null
@@ -1,65 +0,0 @@
-package Bot::Games::OO::Game;
-use Bot::Games::OO ();
-
-sub command {
- my $caller = shift;
- my $name = shift;
- my $code;
- $code = shift if ref($_[0]) eq 'CODE';
- my %args = @_;
-
- my $method_meta = $caller->meta->get_method($name);
- my $superclass = Moose::blessed($method_meta)
- || $caller->meta->method_metaclass;
- my @method_metaclass_roles = ('Bot::Games::Trait::Method::Command');
- push @method_metaclass_roles, 'Bot::Games::Trait::Method::Formatted'
- if $args{formatter};
- my $method_metaclass = Moose::Meta::Class->create_anon_class(
- superclasses => [$superclass],
- roles => \@method_metaclass_roles,
- cache => 1,
- );
- if ($method_meta) {
- $method_metaclass->rebless_instance($method_meta);
- }
- else {
- $method_meta = $method_metaclass->name->wrap(
- $code,
- package_name => $caller,
- name => $name,
- );
- $caller->meta->add_method($name, $method_meta);
- }
- for my $attr (map { $_->meta->get_attribute_list } @method_metaclass_roles) {
- next unless exists $args{$attr};
- my $value = $args{$attr};
- my $munge_method = "_munge_$attr";
- $value = $method_meta->$munge_method($value)
- if $method_meta->can($munge_method);
- $method_meta->$attr($value);
- }
-}
-
-Moose::Exporter->setup_import_methods(
- with_caller => ['command'],
- also => ['Bot::Games::OO'],
-);
-
-sub init_meta {
- shift;
- my %options = @_;
- Moose->init_meta(%options);
- Moose::Util::MetaRole::apply_metaclass_roles(
- for_class =>
- $options{for_class},
- attribute_metaclass_roles =>
- ['Bot::Games::Trait::Attribute::Command',
- 'Bot::Games::Trait::Attribute::Formatted'],
- metaclass_roles =>
- ['Bot::Games::Trait::Class::Command',
- 'Bot::Games::Trait::Class::Formatted'],
- );
- return $options{for_class}->meta;
-}
-
-1;