Also see Moose::Manual::Delta for more details of, and workarounds
for, noteworthy changes.
+NEXT
+
+ [BUG FIXES]
+
+ * When using native delegations, if an array or hash ref member failed a
+ type constraint check, Moose ended up erroring out with "Can't call method
+ "get_message" on unblessed reference" instead of generating a useful error
+ based on the failed type constraint. Reported by t0m. (Dave Rolsky)
+
1.19 Tue, Nov 2, 2010
[BUG FIXES]
return '$member_tc->($_) || '
. $self->_inline_throw_error(
qq{"A new member value for '$attr_name' does not pass its type constraint because: "}
- . ' . $member_tc->get_message($_)',
+ . ' . $member_tc_obj->get_message($_)',
"data => \$_"
) . " for $new_value;";
}
);
}
+{
+ package Bar;
+ use Moose;
+}
+
+{
+ package HasArray;
+ use Moose;
+
+ has objects => (
+ isa => 'ArrayRef[Foo]',
+ traits => ['Array'],
+ handles => {
+ push_objects => 'push',
+ },
+ );
+}
+
+{
+ my $ha = HasArray->new();
+
+ like(
+ exception { $ha->push_objects( Bar->new ) },
+ qr/\QValidation failed for 'Foo'/,
+ 'got expected error when pushing an object of the wrong class onto an array ref'
+ );
+}
+
done_testing;