X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2Fmoose-presentations.git;a=blobdiff_plain;f=moose-class%2Fslides%2Findex.html;fp=moose-class%2Fslides%2Findex.html;h=e8302e4e73cbe636f765ed888232e74e28c1cd6d;hp=46ac36ab9225822fa1e8e023c01e5960fceb5602;hb=a88cc08084397dc7667e26dc315fb5492d8bf558;hpb=66b11069294324c31214650bd2e466fb75acd1f5 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?