From: Shawn M Moore Date: Wed, 26 Nov 2008 07:06:55 +0000 (+0000) Subject: Attempt to explain why a role that just requires methods is useful. Prose cleanups... X-Git-Tag: 0.62~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d520cf3bd091b9ea962264bc183b52c4a3fa2002;p=gitmo%2FMoose.git Attempt to explain why a role that just requires methods is useful. Prose cleanups welcome. --- diff --git a/Changes b/Changes index 630e108..109ca84 100644 --- a/Changes +++ b/Changes @@ -27,6 +27,9 @@ Revision history for Perl extension Moose - added test for this (Sartak) * Moose::Role - more consistent error messages (Sartak) + * Moose::Cookbook::Roles::Recipe1 + - attempt to explain why a role that just requires + methods is useful (Sartak) 0.61 Fri November 7, 2008 * Moose::Meta::Attribute diff --git a/lib/Moose/Cookbook/Roles/Recipe1.pod b/lib/Moose/Cookbook/Roles/Recipe1.pod index eca8887..82ae9fe 100644 --- a/lib/Moose/Cookbook/Roles/Recipe1.pod +++ b/lib/Moose/Cookbook/Roles/Recipe1.pod @@ -144,7 +144,11 @@ target class need implement. } Next up is B. This is a very simple role, akin to B. It merely -requires a C method. +requires a C method. Roles that only require methods are very much +like Java's interfaces. If we know that a class does the B role, it +not only tells us that we can call the C method on it, but also that +C has the precise semantics we want (consider classes B and +B, both with method C). Finally, we come to B, a class that allows us to reap the benefits of our hard work. This is a regular Moose class, so we include the normal C