Merge branch 'master' into attribute_helpers
Hans Dieter Pearcey [Wed, 8 Jul 2009 15:11:19 +0000 (11:11 -0400)]
Conflicts:
Changes
lib/Moose/Meta/Method/Delegation.pm
t/020_attributes/010_attribute_delegation.t

62 files changed:
Changes
Makefile.PL
README
lib/Moose.pm
lib/Moose/Cookbook/Basics/Recipe10.pod
lib/Moose/Cookbook/Basics/Recipe11.pod
lib/Moose/Cookbook/Basics/Recipe9.pod
lib/Moose/Cookbook/Extending/Recipe1.pod
lib/Moose/Error/Confess.pm
lib/Moose/Error/Croak.pm
lib/Moose/Error/Default.pm
lib/Moose/Exporter.pm
lib/Moose/Manual.pod
lib/Moose/Manual/BestPractices.pod
lib/Moose/Manual/Contributing.pod
lib/Moose/Manual/Delta.pod
lib/Moose/Manual/FAQ.pod
lib/Moose/Manual/MooseX.pod
lib/Moose/Manual/Roles.pod
lib/Moose/Meta/Attribute.pm
lib/Moose/Meta/Class.pm
lib/Moose/Meta/Class/Immutable/Trait.pm
lib/Moose/Meta/Instance.pm
lib/Moose/Meta/Method.pm
lib/Moose/Meta/Method/Accessor.pm
lib/Moose/Meta/Method/Augmented.pm
lib/Moose/Meta/Method/Constructor.pm
lib/Moose/Meta/Method/Delegation.pm
lib/Moose/Meta/Method/Destructor.pm
lib/Moose/Meta/Method/Overridden.pm
lib/Moose/Meta/Role.pm
lib/Moose/Meta/Role/Application.pm
lib/Moose/Meta/Role/Application/RoleSummation.pm
lib/Moose/Meta/Role/Application/ToClass.pm
lib/Moose/Meta/Role/Application/ToInstance.pm
lib/Moose/Meta/Role/Application/ToRole.pm
lib/Moose/Meta/Role/Composite.pm
lib/Moose/Meta/Role/Method.pm
lib/Moose/Meta/Role/Method/Conflicting.pm
lib/Moose/Meta/Role/Method/Required.pm
lib/Moose/Meta/TypeCoercion.pm
lib/Moose/Meta/TypeCoercion/Union.pm
lib/Moose/Meta/TypeConstraint.pm
lib/Moose/Meta/TypeConstraint/Class.pm
lib/Moose/Meta/TypeConstraint/DuckType.pm
lib/Moose/Meta/TypeConstraint/Enum.pm
lib/Moose/Meta/TypeConstraint/Parameterizable.pm
lib/Moose/Meta/TypeConstraint/Parameterized.pm
lib/Moose/Meta/TypeConstraint/Registry.pm
lib/Moose/Meta/TypeConstraint/Role.pm
lib/Moose/Meta/TypeConstraint/Union.pm
lib/Moose/Object.pm
lib/Moose/Role.pm
lib/Moose/Util.pm
lib/Moose/Util/MetaRole.pm
lib/Moose/Util/TypeConstraints.pm
lib/Moose/Util/TypeConstraints/OptimizedConstraints.pm
lib/Test/Moose.pm
lib/oose.pm
t/010_basics/001_basic_class_setup.t
t/020_attributes/010_attribute_delegation.t
t/020_attributes/027_accessor_override_method.t

diff --git a/Changes b/Changes
index ced07dc..7a5fb8f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,7 @@
 Also see Moose::Manual::Delta for more details of, and workarounds
 for, noteworthy changes.
 
-
+0.88
     * Moose::Meta::Attribute
       - Added the currying syntax for delegation from AttributeHelpers
         to the existing delegation API. (hdp)
@@ -10,6 +10,20 @@ for, noteworthy changes.
       - Moved in from MooseX with API tweaks. See Moose::Manual::Delta for
         details. (hdp, jhannah, rbuels)
 
+0.87 Tue Jul 7, 2009
+    * Moose::Meta::Method::Delegation
+      - Once again allow class names as well as objects for
+        delegation. This was changed in 0.86.
+
+0.86 Fri Jul 3, 2009
+    * Moose::Meta::Class::Immutable::Trait
+      - Fixes to work with the latest Class::MOP.
+
+    * Moose::Meta::Method::Delegation
+      - Delegation now dies with a more useful error message if the
+        attribute's accessor returns something defined but
+        unblessed. (hdp)
+
 0.85 Fri, Jun 26, 2009
     * Moose::Meta::Attribute
       - The warning for 'no associated methods' is now split out into
index 3574a1a..0949ab3 100644 (file)
@@ -12,7 +12,7 @@ license 'perl';
 
 requires 'Scalar::Util'     => '1.19';
 requires 'Carp';
-requires 'Class::MOP'       => '0.88';
+requires 'Class::MOP'       => '0.89';
 requires 'List::MoreUtils'  => '0.12';
 requires 'Sub::Exporter'    => '0.980';
 requires 'Task::Weaken'     => '0';
diff --git a/README b/README
index c5b5fd7..2f4e603 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Moose version 0.85
+Moose version 0.87
 ===========================
 
 See the individual module documentation for more information
index 18163ca..f98cdea 100644 (file)
@@ -4,7 +4,7 @@ use warnings;
 
 use 5.008;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -13,7 +13,7 @@ use Carp         'confess';
 
 use Moose::Exporter;
 
-use Class::MOP 0.88;
+use Class::MOP 0.89;
 
 use Moose::Meta::Class;
 use Moose::Meta::TypeConstraint;
@@ -574,7 +574,7 @@ With the duck type option, you pass a duck type object whose "interface" then
 becomes the list of methods to handle. The "interface" can be defined as; the
 list of methods passed to C<duck_type> to create a duck type object. For more
 information on C<duck_type> please check
-L<Moose::Util::TypeConstraint|Moose::Util::TypeConstraint>.
+L<Moose::Util::TypeConstraints>.
 
 =item C<CODE>
 
@@ -787,7 +787,7 @@ B<are not> overridden, or removed.
 
 =item B<around $name|@names =E<gt> sub { ... }>
 
-This three items are syntactic sugar for the before, after, and around method
+These three items are syntactic sugar for the before, after, and around method
 modifier features that L<Class::MOP> provides. More information on these may be
 found in the L<Class::MOP::Class documentation|Class::MOP::Class/"Method
 Modifiers"> for now.
index ecbfc99..ed0b7d3 100644 (file)
@@ -3,7 +3,7 @@
 
 =head1 NAME
 
-Moose::Cookbook::Basics::Recipe11 - Using BUILDARGS and BUILD to hook into object construction
+Moose::Cookbook::Basics::Recipe10 - Using BUILDARGS and BUILD to hook into object construction
 
 =head1 SYNOPSIS
 
index 1a44f67..82b7cf3 100644 (file)
@@ -16,7 +16,7 @@ BEGIN {
 
 =head1 NAME
 
-Moose::Cookbook::Basics::Recipe12 - Extending a non-Moose base class
+Moose::Cookbook::Basics::Recipe11 - Extending a non-Moose base class
 
 =head1 SYNOPSIS
 
index 8cafe18..5d4c54a 100644 (file)
@@ -3,7 +3,7 @@
 
 =head1 NAME
 
-Moose::Cookbook::Basics::Recipe10 - Operator overloading, subtypes, and coercion
+Moose::Cookbook::Basics::Recipe9 - Operator overloading, subtypes, and coercion
 
 =head1 SYNOPSIS
 
index 46dd5fe..a20a1b7 100644 (file)
@@ -109,13 +109,12 @@ this works. These both build on top of the L<MooseX::Types> extension.
 
 =head1 ROLES VS TRAITS VS SUBCLASSES
 
-It is important to understand that B<roles and traits are the same
-thing>. A role can be used as a trait, and a trait is a role. The only
-thing that distinguishes the two is that a trait is packaged in a way
-that lets Moose resolve a short name to a class name. In other words,
-with a trait, the caller can refer to it by a short name like "Big",
-and Moose will resolve it to a class like
-C<MooseX::Embiggen::Meta::Attribute::Role::Big>.
+It is important to understand that B<roles and traits are the same thing>. A
+trait is simply a role applied to a metaclass. The only thing that may
+distinguish the two is that a trait can be packaged in a way that lets Moose
+resolve a short name to a class name. In other words, with a trait, the caller
+can refer to it by a short name like "Big", and Moose will resolve it to a
+class like C<MooseX::Embiggen::Meta::Attribute::Role::Big>.
 
 See L<Moose::Cookbook::Meta::Recipe3> and
 L<Moose::Cookbook::Meta::Recipe5> for examples of traits in action. In
index 64eb9e7..ede14a7 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Error::Confess;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index a686164..805420e 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Error::Croak;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 029abb3..79981e8 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Error::Default;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 6a4014d..14ed924 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Exporter;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index c6e8904..17981ba 100644 (file)
@@ -99,7 +99,7 @@ We'll leave the line-by-line explanation of this code to other
 documentation, but you can see how Moose reduces common OO idioms to
 simple declarative constructs.
 
-=head2 TABLE OF CONTENTS
+=head1 TABLE OF CONTENTS
 
 This manual consists of a number of documents.
 
index 30c5673..1db01de 100644 (file)
@@ -32,8 +32,16 @@ Moose sugar and making your class immutable.
 
   1;
 
-The C<no Moose> bit is simply good code hygiene, and making classes
-immutable speeds up a lot of things, most notably object construction.
+The C<no Moose> bit is simply good code hygiene, as it removes all the
+Moose keywords from your class's namespace. Once the class has been
+built, these keywords are not needed needed. The C<make_immutable>
+call allows Moose to speed up a lot of things, most notably object
+construction. The tradeoff is that you can no longer change the class
+definition.
+
+A more generic way to unimport not only L<Moose>'s exports but also
+those from type libraries and other modules is to use
+L<namespace::clean> or L<namespace::autoclean>.
 
 =head2 Never override C<new>
 
@@ -84,7 +92,7 @@ Also, keep your builder methods private.
 
 Lazy is good, and often solves initialization ordering problems. It's
 also good for deferring work that may never have to be done. If you're
-going to be lazy, use I<lazy_build> to save yourself some typing and
+going to be lazy, use C<lazy_build> to save yourself some typing and
 standardize names.
 
 =head2 Consider keeping clearers and predicates private
@@ -106,6 +114,15 @@ If you I<must> make an attribute read-write, consider making the
 writer a separate private method. Narrower APIs are easy to maintain,
 and mutable state is trouble.
 
+In order to declare such attributes, provide a private C<writer>
+parameter:
+
+    has pizza => (
+        is     => 'ro',
+        isa    => 'Pizza',
+        writer => '_pizza',
+    );
+
 =head2 Think twice before changing an attribute's type in a subclass
 
 Down this path lies great confusion. If the attribute is an object
index 76858f8..b68f9b2 100644 (file)
@@ -7,15 +7,15 @@ Moose::Manual::Contributing - How to get involved in Moose
 =head1 GETTING INVOLVED
 
 Moose is a pretty open project and we are always willing to accept bug
-fixes, more tests and doc patches. Doing these things is as simple as
-cloning a copy of the git repository and hacking.
+fixes, more tests and documentation patches. Doing these things is as simple as
+cloning a copy of the Git repository and hacking.
 
 Commit bits are given out freely. All we ask is that for any
 non-trivial code patches, you check with one of the core developers
 before applying said patch.
 
 Alternatively, you can make a new branch with your change and push it
-back to the Moose git server, then ask a core dev to review your
+back to the Moose Git server, then ask a core dev to review your
 branch.
 
 =head2 IRC and Email
index d8a9436..4cfe14a 100644 (file)
@@ -217,7 +217,7 @@ just the first missing method.
 Moose will no longer inline a constructor for your class unless it
 inherits its constructor from Moose::Object, and will warn when it
 doesn't inline. If you want to force inlining anyway, pass
-C<< "replace_constructor => 1 >> to C<make_immutable>.
+C<< replace_constructor => 1 >> to C<make_immutable>.
 
 If you want to get rid of the warning, pass C<< inline_constructor =>
 0 >>.
index 442e6d1..4f5888a 100644 (file)
@@ -298,14 +298,14 @@ This will allow the coercion to apply only to strings that fail to look like an
 
 =head3 Why is BUILD not called for my composed roles?
 
-BUILD is never called in composed roles. The primary reason is that
+C<BUILD> is never called in composed roles. The primary reason is that
 roles are B<not> order sensitive. Roles are composed in such a way
 that the order of composition does not matter (for information on the
 deeper theory of this read the original traits papers here
 L<http://www.iam.unibe.ch/~scg/Research/Traits/>).
 
 Because roles are essentially unordered, it would be impossible to
-determine the order in which to execute the BUILD methods.
+determine the order in which to execute the C<BUILD> methods.
 
 As for alternate solutions, there are a couple.
 
index 8327e13..27e1999 100644 (file)
@@ -233,7 +233,7 @@ attributes.
 
   class_has 'Cache' => ( ... );
 
-Note however that this class attribute does -not- inherit like a
+Note however that this class attribute does I<not> inherit like a
 L<Class::Data::Inheritable> or similar attribute - calling
 
   $subclass->Cache($cache);
index 6a310a4..88d94d8 100644 (file)
@@ -231,15 +231,15 @@ However, aliasing a method simply makes a I<copy> of the method with
 the new name. We also need to exclude the original name:
 
   with 'Breakable' => {
-      alias   => { break => 'break_bone' },
-      exclude => 'break',
+      alias    => { break => 'break_bone' },
+      excludes => 'break',
       },
       'Breakdancer' => {
-      alias   => { break => 'break_dance' },
-      exclude => 'break',
+      alias    => { break => 'break_dance' },
+      excludes => 'break',
       };
 
-The exclude parameter prevents the C<break> method from being composed
+The excludes parameter prevents the C<break> method from being composed
 into the C<FragileDancer> class, so we don't have a conflict. This
 means that C<FragileDancer> does not need to implement its own
 C<break> method.
index 49a9a45..f7a0e34 100644 (file)
@@ -7,7 +7,7 @@ use warnings;
 use Scalar::Util 'blessed', 'weaken';
 use overload     ();
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 our $AUTHORITY = 'cpan:STEVAN';
 
 use Moose::Meta::Method::Accessor;
@@ -586,7 +586,7 @@ sub _process_accessors {
      && (!$self->definition_context
       || $method->package_name eq $self->definition_context->{package})) {
         Carp::cluck(
-            "You cannot overwrite a locally defined method ($accessor) with "
+            "You are overwriting a locally defined method ($accessor) with "
           . "an accessor"
         );
     }
index d591d21..06e2d23 100644 (file)
@@ -11,7 +11,7 @@ use List::Util qw( first );
 use List::MoreUtils qw( any all uniq first_index );
 use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 7099aa4..51e2eb7 100644 (file)
@@ -5,16 +5,18 @@ use warnings;
 
 use Class::MOP;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Class::MOP::Class::Immutable::Trait';
 
-sub add_role { shift->_immutable_cannot_call }
+sub add_role { $_[1]->_immutable_cannot_call }
 
 sub calculate_all_roles {
-    @{ $_[0]{__immutable}{calculate_all_roles} ||= [ shift->next::method ] };
+    my $orig = shift;
+    my $self = shift;
+    @{ $self->{__immutable}{calculate_all_roles} ||= [ $self->$orig ] };
 }
 
 1;
index 790bddd..8fc98f7 100644 (file)
@@ -4,7 +4,7 @@ package Moose::Meta::Instance;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index ab15903..b50c94e 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Meta::Method;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 944adf8..957ba16 100644 (file)
@@ -4,7 +4,7 @@ package Moose::Meta::Method::Accessor;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index af31d52..34fa04e 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Meta::Method::Augmented;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 8038252..898e0a4 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 
 use Scalar::Util 'blessed', 'weaken', 'looks_like_number', 'refaddr';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Moose::Meta::Method',
index 910beb4..f353161 100644 (file)
@@ -7,7 +7,7 @@ use warnings;
 use Carp         'confess';
 use Scalar::Util 'blessed', 'weaken';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -88,15 +88,22 @@ sub _initialize_body {
     $self->{body} = sub {
         my $instance = shift;
         my $proxy    = $instance->$accessor();
-        ( defined $proxy )
-            || $self->throw_error(
-            "Cannot delegate $handle_name to $method_to_call because "
-                . "the value of "
-                . $self->associated_attribute->name
-                . " is not defined",
-            method_name => $method_to_call,
-            object      => $instance
+
+        my $error
+            = !defined $proxy                 ? ' is not defined'
+            : ref($proxy) && !blessed($proxy) ? qq{ is not an object (got '$proxy')}
+            : undef;
+
+        if ($error) {
+            $self->throw_error(
+                "Cannot delegate $handle_name to $method_to_call because "
+                    . "the value of "
+                    . $self->associated_attribute->name
+                    . $error,
+                method_name => $method_to_call,
+                object      => $instance
             );
+        }
         my @args = (@{ $self->curried_arguments }, @_);
         $proxy->$method_to_call(@args);
     };
index 7d7b22a..98121fc 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 
 use Scalar::Util 'blessed', 'weaken';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 6c3d086..1e3d61e 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Meta::Method::Overridden;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 4be6a19..82ce504 100644 (file)
@@ -10,7 +10,7 @@ use Carp         'confess';
 use Sub::Name    'subname';
 use Devel::GlobalDestruction 'in_global_destruction';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -793,7 +793,7 @@ This method creates a new role object with the provided name.
 
 This method accepts a list of array references. Each array reference
 should contain a role name as its first element. The second element is
-an optional hash reference. The hash reference can contain C<exclude>
+an optional hash reference. The hash reference can contain C<excludes>
 and C<alias> keys to control how methods are composed from the role.
 
 The return value is a new L<Moose::Meta::Role::Composite> that
index e4979f4..ce9c9c9 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use metaclass;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 2fb58e6..99e78f9 100644 (file)
@@ -8,7 +8,7 @@ use Scalar::Util 'blessed';
 
 use Moose::Meta::Role::Composite;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 22d0ef6..be5f9e0 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 use Moose::Util  'english_list';
 use Scalar::Util 'weaken', 'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 9a01ff3..0502497 100644 (file)
@@ -6,7 +6,7 @@ use metaclass;
 
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 3908179..aac3575 100644 (file)
@@ -6,7 +6,7 @@ use metaclass;
 
 use Scalar::Util    'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 796005f..9f0aaac 100644 (file)
@@ -6,7 +6,7 @@ use metaclass;
 
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 16e949a..114a5ff 100644 (file)
@@ -4,7 +4,7 @@ package Moose::Meta::Role::Method;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 2676164..49d8ae8 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 
 use base qw(Moose::Meta::Role::Method::Required);
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 6291666..643679a 100644 (file)
@@ -10,7 +10,7 @@ use overload '""'     => sub { shift->name },   # stringify to method name
 
 use base qw(Class::MOP::Object);
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index ec2eedb..5b8a196 100644 (file)
@@ -8,7 +8,7 @@ use metaclass;
 use Moose::Meta::Attribute;
 use Moose::Util::TypeConstraints ();
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 5547275..d1c3b2e 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 487d345..1be9f7e 100644 (file)
@@ -13,7 +13,7 @@ use Sub::Name qw(subname);
 
 use base qw(Class::MOP::Object);
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index dc75e39..0acc434 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 use Scalar::Util 'blessed';
 use Moose::Util::TypeConstraints ();
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index bc3062c..f945fff 100644 (file)
@@ -9,7 +9,7 @@ use Moose::Util 'english_list';
 
 use Moose::Util::TypeConstraints ();
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 7aeae23..def1402 100644 (file)
@@ -6,7 +6,7 @@ use metaclass;
 
 use Moose::Util::TypeConstraints ();
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 7ca1231..f216ec4 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use metaclass;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index cdefd60..384db70 100644 (file)
@@ -8,7 +8,7 @@ use Scalar::Util 'blessed';
 use Moose::Util::TypeConstraints;
 use Moose::Meta::TypeConstraint::Parameterizable;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 47c5c23..dc9daef 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 
 use Scalar::Util 'blessed';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index a69a074..049b294 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 use Scalar::Util 'blessed';
 use Moose::Util::TypeConstraints ();
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index c4a8026..c0e5154 100644 (file)
@@ -7,7 +7,7 @@ use metaclass;
 
 use Moose::Meta::TypeCoercion::Union;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index bb7accf..35ffe65 100644 (file)
@@ -11,7 +11,7 @@ use Scalar::Util;
 use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class';
 use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index b9e5686..78e36ee 100644 (file)
@@ -7,7 +7,7 @@ use Carp         'croak';
 
 use Sub::Exporter;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -175,7 +175,7 @@ Moose::Role - The Moose Role
 
 =head1 DESCRIPTION
 
-The concept of roles is documented in L<Moose::Manual::Role>. This document
+The concept of roles is documented in L<Moose::Manual::Roles>. This document
 serves as API documentation.
 
 =head1 EXPORTED FUNCTIONS
index c50adf2..fe14e95 100644 (file)
@@ -8,7 +8,7 @@ use Sub::Exporter;
 use Scalar::Util 'blessed';
 use Class::MOP   0.60;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -274,7 +274,7 @@ applicant can be a role name, class name, or object.
 The C<$applicant> must already have a metaclass object.
 
 The list of C<@roles> should be a list of names, each of which can be
-followed by an optional hash reference of options (C<exclude> and
+followed by an optional hash reference of options (C<excludes> and
 C<alias>).
 
 =item B<ensure_all_roles($applicant, @roles)>
index 9d37761..3bc73f6 100644 (file)
@@ -3,7 +3,7 @@ package Moose::Util::MetaRole;
 use strict;
 use warnings;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 2ee25fc..79c1a84 100644 (file)
@@ -6,7 +6,7 @@ use List::MoreUtils qw( all any );
 use Scalar::Util qw( blessed reftype );
 use Moose::Exporter;
 
-our $VERSION = '0.85';
+our $VERSION = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index c4dc4af..1cf7ab4 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 use Class::MOP;
 use Scalar::Util 'blessed', 'looks_like_number';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 2cf1bad..099521c 100644 (file)
@@ -8,7 +8,7 @@ use Test::Builder;
 
 use Moose::Util 'does_role', 'find_meta';
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index 1e9b6f6..45eb0a8 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use Class::MOP;
 
-our $VERSION   = '0.85';
+our $VERSION   = '0.87';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
index acfde73..00d709c 100644 (file)
@@ -31,14 +31,14 @@ dies_ok {
 can_ok('Foo', 'does');
 
 foreach my $function (qw(
-                                                extends
-                        has
-                            before after around
-                            blessed confess
-                                                type subtype as where
-                                                coerce from via
-                                                find_type_constraint
-                            )) {
+                         extends
+                         has
+                         before after around
+                         blessed confess
+                         type subtype as where
+                         coerce from via
+                         find_type_constraint
+                         )) {
     ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
 }
 
index 7e44c45..e3a5f0a 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 89;
+use Test::More tests => 92;
 use Test::Exception;
 
 
@@ -21,6 +21,8 @@ use Test::Exception;
 
     has 'bar' => (is => 'rw', default => 10);
 
+    sub baz { 42 }
+
     package Bar;
     use Moose;
 
@@ -29,8 +31,9 @@ use Test::Exception;
         default => sub { Foo->new },
         handles => {
             'foo_bar' => 'bar',
+            foo_baz => 'baz',
             'foo_bar_to_20' => [ bar => [ 20 ] ],
-        }
+        },
     );
 }
 
@@ -269,7 +272,7 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
         my $self = shift;
 
         my $name = our $AUTOLOAD;
-        $name =~ s/.*://;              # strip fully-qualified portion
+        $name =~ s/.*://; # strip fully-qualified portion
 
         if (@_) {
             return $self->{$name} = shift;
@@ -417,3 +420,17 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
     ok(!$i->meta->has_method('foo_bar'), 'handles method foo_bar is removed');
 }
 
+# Make sure that a useful error message is thrown when the delegation target is
+# not an object
+{
+    my $i = Bar->new(foo => undef);
+    throws_ok { $i->foo_bar } qr/is not defined/,
+        'useful error from unblessed reference';
+
+    my $j = Bar->new(foo => []);
+    throws_ok { $j->foo_bar } qr/is not an object \(got 'ARRAY/,
+        'useful error from unblessed reference';
+
+    my $k = Bar->new(foo => "Foo");
+    lives_ok { $k->foo_baz } "but not for class name";
+}
index 22f562a..16ab21a 100644 (file)
@@ -22,12 +22,12 @@ BEGIN {
 
 my $foo_meta = Foo->meta;
 stderr_like(sub { $foo_meta->add_attribute(a => (reader => 'get_a')) },
-            qr/^You cannot overwrite a locally defined method \(get_a\) with an accessor/, 'reader overriding gives proper warning');
+            qr/^You are overwriting a locally defined method \(get_a\) with an accessor/, 'reader overriding gives proper warning');
 stderr_like(sub { $foo_meta->add_attribute(b => (writer => 'set_b')) },
-            qr/^You cannot overwrite a locally defined method \(set_b\) with an accessor/, 'writer overriding gives proper warning');
+            qr/^You are overwriting a locally defined method \(set_b\) with an accessor/, 'writer overriding gives proper warning');
 stderr_like(sub { $foo_meta->add_attribute(c => (predicate => 'has_c')) },
-            qr/^You cannot overwrite a locally defined method \(has_c\) with an accessor/, 'predicate overriding gives proper warning');
+            qr/^You are overwriting a locally defined method \(has_c\) with an accessor/, 'predicate overriding gives proper warning');
 stderr_like(sub { $foo_meta->add_attribute(d => (clearer => 'clear_d')) },
-            qr/^You cannot overwrite a locally defined method \(clear_d\) with an accessor/, 'clearer overriding gives proper warning');
+            qr/^You are overwriting a locally defined method \(clear_d\) with an accessor/, 'clearer overriding gives proper warning');
 stderr_like(sub { $foo_meta->add_attribute(e => (is => 'rw')) },
-            qr/^You cannot overwrite a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning');
+            qr/^You are overwriting a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning');