Subject: | Mouse fails on isa => 'Maybe[HashRef]' constraint |
Attached code fails with an error in Mouse::Meta::Attribute, where the Moose version seems
to behave sanely.
$ perl MoosePass.plx
$ perl MouseFail.plx
Undefined subroutine &overload::StrVal called at
/opt/local/lib/perl5/site_perl/5.8.8/Mouse/Meta/Attribute.pm line 290.
Doing a full backtrace in the debugger shows it looks like something might be stringifying
the hashref when verify_type_constraint's called:
Undefined subroutine &overload::StrVal called at
/opt/local/lib/perl5/site_perl/5.8.8/Mouse/Meta/Attribute.pm line 290.
at /opt/local/lib/perl5/site_perl/5.8.8/Mouse/Meta/Attribute.pm line 290
Mouse::Meta::Attribute::verify_type_constraint('Mouse::Meta::Attribute=HASH(0x8cafd4)',
'HASH(0x9594c4)') called at /opt/local/lib/perl5/site_perl/5.8.8/Mouse/Object.pm line 45
Mouse::Object::new('MouseFail') called at MouseFail.plx line 11
Subject: | MouseFail.plx |
package MouseFail;
use Mouse;
has 'foo' => ( is => 'rw', isa => 'Maybe[HashRef]', default => sub { return +{} } );
no Mouse;
package main;
my $fail = MouseFail->new();
exit 0;
__END__
Subject: | MoosePass.plx |
package MoosePass;
use Moose;
has 'foo' => ( is => 'rw', isa => 'Maybe[HashRef]', default => sub { return +{} } );
no Mouse;
package main;
my $fail = MoosePass->new();
exit 0;
__END__