summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games/OO.pm
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-14 05:08:13 -0500
committerdoy <doy@tozt.net>2009-01-14 05:08:13 -0500
commit76ded94cf254c45f8516f298be5ee534cc453e5b (patch)
tree1b2a581f0f40f239cd125bb1ade11d30549826b0 /lib/Bot/Games/OO.pm
parent0fcb234e4b40ddc2b933fa6957d90a86c243cee3 (diff)
downloadbot-games-76ded94cf254c45f8516f298be5ee534cc453e5b.tar.gz
bot-games-76ded94cf254c45f8516f298be5ee534cc453e5b.zip
add the beginnings of a meta-object structure
Diffstat (limited to 'lib/Bot/Games/OO.pm')
-rw-r--r--lib/Bot/Games/OO.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/Bot/Games/OO.pm b/lib/Bot/Games/OO.pm
new file mode 100644
index 0000000..a44dcb4
--- /dev/null
+++ b/lib/Bot/Games/OO.pm
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+package Bot::Games::OO;
+use Moose ();
+use Moose::Exporter;
+
+use Bot::Games::Meta::Class;
+use Bot::Games::Meta::Method::Command;
+
+sub command($&) {
+ my $class = shift;
+ my ($name, $code) = @_;
+ # XXX: is $class->meta what i want? should i be calling some form of
+ # ->initialize? should i be calling ->get_metaclass_by_name? who knows!
+ $class->meta->add_method($name, Bot::Games::Meta::Method::Command->wrap(
+ $code,
+ package_name => $class,
+ name => $name,
+ ));
+}
+
+Moose::Exporter->setup_import_methods(
+ with_caller => ['command'],
+ also => ['Moose'],
+);
+
+sub init_meta {
+ shift;
+ return Moose->init_meta(@_, metaclass => 'Bot::Games::Meta::Class');
+}
+
+1;