Permalink
Browse files

Implement a couple prototypes for injecting event loops into Reflex::…

…Base. Heavily leaning on confound's advice from irc.perl.org #moose.
  • Loading branch information...
1 parent 8b5146a commit 30bfa45994926534e5c94bc0dd83edf980edd8d6 @rcaputo committed Jul 6, 2011
@@ -0,0 +1,6 @@
+package BaseClass;
+use Moose;
+
+no Moose;
+
+1;
@@ -0,0 +1,24 @@
+package BaseUseWith;
+use Moose;
+
+sub generic_helper {
+ my ($self, @etc) = @_;
+ warn "$self posted (@etc)";
+}
+
+sub import {
+ my ($class, %args) = @_;
+
+ return unless exists $args{with};
+
+ my $args = $args{with};
+ $args = [ $args ] unless ref($args);
+
+ Moose::Util::apply_all_roles($class, @$args);
+
+ return;
+};
+
+no Moose;
+
+1;
@@ -0,0 +1,11 @@
+package EventyRole;
+use Moose::Role;
+
+sub post {
+ my ($self, @etc) = @_;
+ warn "$self->post(@etc)\n";
+}
+
+no Moose;
+
+1;
@@ -0,0 +1,13 @@
+package EventySubSystem;
+use Moose::Role;
+
+sub post {
+ my ($self, @etc) = @_;
+ warn "$self->post(@etc)\n";
+}
+
+Moose::Util::apply_all_roles(BaseClass => __PACKAGE__);
+
+no Moose;
+
+1;
@@ -0,0 +1,7 @@
+#!/usr/bin/env perl
+
+use BaseClass;
+use EventySubSystem;
+
+my $object = BaseClass->new();
+$object->post(1, 2, 3);
@@ -0,0 +1,6 @@
+#!/usr/bin/env perl
+
+use BaseUseWith (with => "EventyRole");
+
+my $object = BaseUseWith->new();
+$object->post(1, 2, 3);

0 comments on commit 30bfa45

Please sign in to comment.