From: Dave Rolsky Date: Thu, 3 Feb 2011 21:19:44 +0000 (-0600) Subject: Use Printable role in example of class consuming a role X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=74c87c2d0f63829557e24fc34a7eed525f71d0f6;p=gitmo%2Fmoose-presentations.git Use Printable role in example of class consuming a role --- diff --git a/moose-class/slides/index.html b/moose-class/slides/index.html index 1dd1a48..b193f68 100644 --- a/moose-class/slides/index.html +++ b/moose-class/slides/index.html @@ -1309,23 +1309,23 @@ sub print {
package Person;
 use Moose;
 
-with 'HasPermissions';
+with 'Printable';

Classes Consume Roles

-
my $person = Person->new(
+
package Person;
+
+sub as_string { $_[0]->first_name() }
+
+my $person = Person->new(
     first_name   => 'Kenichi',
     last_name    => 'Asai',
     access_level => 42,
 );
 
-print $person->full_name
-    . ' has '
-    . $person->can_access(42)
-        ? 'great power'
-        : 'little power';
+$person->print();