Also see Moose::Manual::Delta for more details of, and workarounds
for, noteworthy changes.
+0.86
+ * 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
method_name => $method_to_call,
object => $instance
);
+ ( blessed $proxy )
+ || $self->throw_error(
+ "Cannot delegate $handle_name to $method_to_call because "
+ . "the value of "
+ . $self->associated_attribute->name
+ . " is not an object (got '$proxy')",
+ method_name => $method_to_call,
+ object => $instance
+ );
$proxy->$method_to_call(@_);
};
}
use strict;
use warnings;
-use Test::More tests => 88;
+use Test::More tests => 89;
use Test::Exception;
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 => []);
+ throws_ok { $i->foo_bar } qr/is not an object \(got 'ARRAY/,
+ 'useful error from unblessed reference';
+}