Subject: | type constraints not checked |
It doesn't appear that type constraints are checked for class
attributes. Consider:
use strict;
use warnings;
{
package Foo;
use Moose;
use MooseX::ClassAttribute;
class_has attr => (
is => 'ro', isa => 'Int',
default => 'not an int'
);
}
my $obj = Foo->new;
print $obj->attr, "\n";
__END__
not an int
$attr->get_value should not succeed, as the default value clearly does
match the type constraint.
The correct behaviour does occur when the attribute is lazy.