From: Dave Rolsky Date: Fri, 7 Jun 2013 03:54:36 +0000 (-0500) Subject: Add slide attempting to clarify how Moose creates delegation methods X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a88cc08084397dc7667e26dc315fb5492d8bf558;p=gitmo%2Fmoose-presentations.git Add slide attempting to clarify how Moose creates delegation methods --- diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index 46ac36a..e8302e4 100644 --- a/moose-class/slides/index.html +++ b/moose-class/slides/index.html @@ -3138,6 +3138,25 @@ has lungs => (
+

Delegation Explained

+ +
package Person;
+
+has lungs => (
+    is      => 'ro',
+    isa     => 'Lungs',
+    handles => [ 'inhale', 'exhale' ],
+);
+
+sub inhale {
+    my $self = shift;
+    $self->lungs()->inhale();
+}
+
+sub exhale { ... }
+
+ +

Why Delegation?