Subject: | subtype messages are ignored when MooseX::Params::Validate are used |
Date: | Thu, 10 Oct 2013 10:17:43 +0200 |
To: | bug-MooseX-Params-Validate [...] rt.cpan.org |
From: | Grzegorz Dzięgielewski <jabbas [...] jabbas.eu> |
When you define subtypes with message {} and use this type in
MooseX::Params::Validate it throws exception without defined message.
example:
#!/usr/bin/env perl
package Foo;
use Moose;
use Moose::Util::TypeConstraints;
use MooseX::Params::Validate;
subtype "Something"
=> as "Int"
=> where {$_>0}
=> message { "more than zero" }
;
sub bar {
my ($self, $bar) = validated_list(
\@_,
baz => { isa => 'Something' }
);
}
use Test::Exception tests => 2;
my $a = Foo->new();
lives_ok { $->bar(baz => 1) };
throws_ok { $a->bar(baz => 0) } qr/more than zero/;
--
Grzegorz Dzięgielewski
http://jabbas.eu