extra test from FAIL_modify_lazy_handlers
[gitmo/Moo.git] / t / lib / MooObjectWithDelegate.pm
diff --git a/t/lib/MooObjectWithDelegate.pm b/t/lib/MooObjectWithDelegate.pm
new file mode 100644 (file)
index 0000000..db2be38
--- /dev/null
@@ -0,0 +1,27 @@
+package MooObjectWithDelegate;
+use ClassicObject;
+use Moo;
+
+has 'delegated' => (
+  is => 'ro',
+  isa => sub {
+    do { $_[0] && blessed($_[0]) }
+      or die "Not an Object!";
+  },
+  lazy => 1,
+  builder => '_build_delegated',
+  handles => [qw/connect/],
+);
+
+sub _build_delegated {
+  my $self = shift;
+  return ClassicObject->new;
+}
+
+around 'connect', sub {
+  my ($orig, $self, @args) = @_;
+  return $self->$orig(@args) . 'b';
+};
+
+
+1;