Subject: | Misleading exception when using coersion ('undef' instead of requested class). |
See minimal example provided. Despite the default of "Module::I::Dont::Have", being provided, the exception output reads:
Attribute (thing) does not pass the type constraint because: Validation failed for 'MooseX::Types::LoadableClass::LoadableClass' with value undef at accessor My::Module::thing (defined at loadableclass_coerce_default_minimal.pl line 6) line 21.
My::Module::thing('My::Module=HASH(0xa9ada0)') called at loadableclass_coerce_default_minimal.pl line 21
Don't know if this is fixable, may look into it myself later.
Just wanted to get it recorded here anyway.
Cheers,
-d
Subject: | loadableclass_coerce_default_minimal.pl |
package My::Module;
use Moose;
use MooseX::Types::LoadableClass qw{LoadableClass};
has thing => (
is => 'rw',
coerce => 1,
required => 1,
lazy => 1,
isa => LoadableClass,
default => 'Module::I::Dont::Have',
);
1;
package main;
my $obj = My::Module->new;
print $obj->thing;