Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mouse CPAN distribution.

Report information
The Basics
Id: 39795
Status: resolved
Priority: 0/
Queue: Mouse

People
Owner: Nobody in particular
Requestors: fletch+cpan [...] phydeaux.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.09
Fixed in: (no value)



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__
For the record, I would love a patch that adds parameterized types to Mouse. I don't know how hard it is. Maybe it's time we rewrite the code to use an object for each type constraints so we can track metadata much more effectively. Shawn
lestrrat++ has implemented ArrayRef and HashRef parameterized types in 0.19 and Maybe in 0.20. Shawn