Revision history for MooseX-Types-Structured
+0.11 06 April 2009
+ - Fixed braindead bug in the way I override ->validate, which caused
+ valiate to never correctly pass a constraint.
0.10 02 April 2009
- Minor documentation grammar fixes and one major example error fixed
- Much improved error reporting. Now we return the 'internal' error
override 'validate' => sub {
my ($self, @args) = @_;
- my $compiled_type_constraint = $self->_compiled_type_constraint;
my $message = bless {message=>undef}, 'MooseX::Types::Structured::Message';
- my $result = $compiled_type_constraint->(@args, $message);
- if($result) {
- return $result;
+ if ($self->_compiled_type_constraint->(@args, $message)) {
+ ## Everything is good, no error message to return
+ return undef;
} else {
+ ## Whoops, need to figure out the right error message
my $args = Devel::PartialDump::dump(@args);
if(my $message = $message->{message}) {
return $self->get_message("$args, Internal Validation Error is: $message");
use Sub::Exporter -setup => { exports => [ qw(Dict Tuple Optional slurpy) ] };
use Devel::PartialDump;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
our $AUTHORITY = 'cpan:JJNAPIORK';
=head1 NAME
BEGIN {
use strict;
use warnings;
- use Test::More tests=>24;
+ use Test::More tests=>25;
}
use Moose::Util::TypeConstraints;
like $deep_tuple->validate([1,{a=>2},{name=>'Vincent',age=>'Hello'}]),
qr/Error is: Validation failed for 'MooseX::Types::Structured::Dict\[name,Str,age,Int\]'/,
'Example deeper error';
+
+## Success Tests...
+
+ok !$deep_tuple->validate([1,{a=>2},{name=>'John',age=>40}]), 'Validates ok';