Give an error message when a handles attribute's object is undefined, so it doesn...
Shawn M Moore [Sat, 26 Jan 2008 16:50:56 +0000 (16:50 +0000)]
lib/Moose/Meta/Attribute.pm

index 50b23a8..960daf3 100644 (file)
@@ -405,9 +405,10 @@ sub install_accessors {
                 $associated_class->add_method($handle => subname $name, sub {
                     my $proxy = (shift)->$accessor();
                     @_ = ($proxy, @_);
-                    (defined $proxy) 
-                        || confess "Cannot delegate $handle to $method_to_call because " . 
-                                   "the value of " . $self->name . " is not defined";
+
+                    defined($proxy)
+                        or confess "Undefined 'handles' for attribute '".$self->name."' for method '$name'.";
+
                     goto &{ $proxy->can($method_to_call) || return };
                 });
             }