summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-06-02 00:18:41 -0500
committerJesse Luehrs <doy@tozt.net>2009-06-02 01:16:12 -0500
commitbf67b7d5ea5a353b79b724933e23cbe36acd82c2 (patch)
tree818497697336431cd2f79d20f5519a972db93539
parent77f7f5d362f5e1fa1d1d34936af9268778d99132 (diff)
downloadbot-games-bf67b7d5ea5a353b79b724933e23cbe36acd82c2.tar.gz
bot-games-bf67b7d5ea5a353b79b724933e23cbe36acd82c2.zip
add custom exporters for roles
-rw-r--r--lib/Bot/Games/OO/Game/Role.pm28
-rw-r--r--lib/Bot/Games/OO/Role.pm10
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/Bot/Games/OO/Game/Role.pm b/lib/Bot/Games/OO/Game/Role.pm
new file mode 100644
index 0000000..8aee3a4
--- /dev/null
+++ b/lib/Bot/Games/OO/Game/Role.pm
@@ -0,0 +1,28 @@
+package Bot::Games::OO::Game::Role;
+use Bot::Games::OO::Role ();
+
+# XXX: is there a better way to go about this?
+*command = \&Bot::Games::OO::Game::command;
+Moose::Exporter->setup_import_methods(
+ with_caller => ['command'],
+ also => ['Bot::Games::OO::Role'],
+);
+
+sub init_meta {
+ shift;
+ my %options = @_;
+ Moose::Role->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;
diff --git a/lib/Bot/Games/OO/Role.pm b/lib/Bot/Games/OO/Role.pm
new file mode 100644
index 0000000..80810f2
--- /dev/null
+++ b/lib/Bot/Games/OO/Role.pm
@@ -0,0 +1,10 @@
+package Bot::Games::OO::Role;
+use Moose ();
+use MooseX::AttributeHelpers;
+use Moose::Exporter;
+
+Moose::Exporter->setup_import_methods(
+ also => ['Moose::Role'],
+);
+
+1;