summaryrefslogtreecommitdiffstats
path: root/t/lib/Command.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-07-19 19:21:54 -0500
committerJesse Luehrs <doy@tozt.net>2010-07-19 19:21:54 -0500
commitd1bab5d4a5ea4100803c871461c62744767c514b (patch)
tree1e596286d921bdd58e2bc61eef5aff1c91a70e1b /t/lib/Command.pm
parent636f22f307ff0dc94a2c2ec23d49c872ecddbc02 (diff)
downloadmoosex-exporter-easy-master.tar.gz
moosex-exporter-easy-master.zip
a few more testsHEADmaster
Diffstat (limited to 't/lib/Command.pm')
-rw-r--r--t/lib/Command.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/lib/Command.pm b/t/lib/Command.pm
new file mode 100644
index 0000000..b39b8b5
--- /dev/null
+++ b/t/lib/Command.pm
@@ -0,0 +1,31 @@
+package Command;
+use MooseX::Exporter::Easy;
+
+class_metaroles {
+ class => ['Command::Role::Class'],
+};
+
+sub _command_method_meta {
+ my ($meta) = @_;
+ Moose::Meta::Class->create_anon_class(
+ superclasses => [$meta->method_metaclass],
+ roles => ['Command::Role::Method'],
+ cache => 1,
+ )->name;
+}
+
+with_meta command => sub {
+ my ($meta, $name, $code) = @_;
+ $meta->add_method(
+ $name => _command_method_meta($meta)->wrap(
+ $code,
+ name => $name,
+ package_name => $meta->name,
+ associated_metaclass => $meta
+ ),
+ );
+};
+
+export;
+
+1;