Subject: | Native Array trait push method type constraint bug with class types |
As per the attached test, if you have an ArrayRef[Class1] attribute,
which you add a 'push' method to, when you push an instance of a
different class, then you get the error:
Can't call method "get_message" on unblessed reference
rather than the expected type constraint validation failure message.
Subject: | test.pl |
use strict;
use warnings;
use Test::More;
use Test::Exception;
use Moose::Util::TypeConstraints;
class_type 'Foo';
{
package Moo;
use Moose;
}
{
package Bar;
use Moose;
has quux => (
is => 'ro',
isa => 'ArrayRef[Foo]',
traits => ['Array'],
handles => {
push_quux => 'push',
},
);
}
my $bar = Bar->new;
$bar->push_quux(Moo->new);
ok 1;
done_testing;