Checking in changes prior to tagging of version 0.84.
[gitmo/Mouse.git] / lib / Mouse / Role.pm
index e7b74ec..dfa08d9 100644 (file)
@@ -1,7 +1,7 @@
 package Mouse::Role;
 use Mouse::Exporter; # enables strict and warnings
 
-our $VERSION = '0.73';
+our $VERSION = '0.84';
 
 use Carp         qw(confess);
 use Scalar::Util qw(blessed);
@@ -137,12 +137,34 @@ Mouse::Role - The Mouse Role
 
 =head1 VERSION
 
-This document describes Mouse version 0.73
+This document describes Mouse version 0.84
 
 =head1 SYNOPSIS
 
-    package MyRole;
-    use Mouse::Role;
+    package Comparable;
+    use Mouse::Role; # the package is now a Mouse role
+
+    # Declare methods that are required by this role
+    requires qw(compare);
+
+    # Define methods this role provides
+    sub equals {
+        my($self, $other) = @_;
+        return $self->compare($other) == 0;
+    }
+
+    # and later
+    package MyObject;
+    use Mouse;
+    with qw(Comparable); # Now MyObject can equals()
+
+    sub compare {
+        # ...
+    }
+
+    my $foo = MyObject->new();
+    my $bar = MyObject->new();
+    $obj->equals($bar); # yes, it is comparable
 
 =head1 KEYWORDS