Subject: | Type constraint violations don't use custom messages when the type being violated isn't the immediate type of a variable. |
Date: | Mon, 19 Jan 2009 17:17:45 -0600 |
To: | bug-Moose [...] rt.cpan.org |
From: | Elliot Shank <perl [...] galumph.com> |
With this code
package Foo;
use Moose;
use Moose::Util::TypeConstraints;
subtype 'MyType'
=> as 'Str'
=> where { m/foo/ }
=> message { qq/"$_" doesn't look like foo./ };
subtype 'MyTypeList'
=> as 'ArrayRef[MyType]';
has 'foo' => (is => 'rw', isa => 'MyTypeList');
package main;
Foo->new( foo => ['bar'] );
the resulting exception does not include the content of the custom message, which makes it hard to figure out what's wrong.