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

Owner: Nobody in particular
Requestors: fletch+cpan [...]

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

Subject: Mouse fails on isa => 'Maybe[HashRef]' constraint
Download (untitled) / with headers
text/plain 874b
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/ 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/ line 290. at /opt/local/lib/perl5/site_perl/5.8.8/Mouse/Meta/ 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/ line 45 Mouse::Object::new('MouseFail') called at MouseFail.plx line 11
Subject: MouseFail.plx
Download MouseFail.plx
text/plain 191b
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
Download MoosePass.plx
text/plain 191b
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__
Download (untitled) / with headers
text/plain 242b
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
Download (untitled) / with headers
text/plain 102b
lestrrat++ has implemented ArrayRef and HashRef parameterized types in 0.19 and Maybe in 0.20. Shawn

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to