use Carp 'confess';
use Scalar::Util 'blessed';
-our $VERSION = '0.03';
+our $VERSION = '0.04';
use Moose::Meta::TypeConstraint;
use Moose::Meta::TypeCoercion;
{
my %TYPES;
- sub find_type_constraint { $TYPES{$_[0]}->[1] }
-
+ sub find_type_constraint {
+ return $TYPES{$_[0]}->[1]
+ if exists $TYPES{$_[0]};
+ return;
+ }
+
+ sub _dump_type_constraints {
+ require Data::Dumper;
+ Data::Dumper::Dumper \%TYPES;
+ }
+
sub _create_type_constraint {
my ($name, $parent, $check, $message) = @_;
my $pkg_defined_in = scalar(caller(1));
($TYPES{$name}->[0] eq $pkg_defined_in)
- || confess "The type constraint '$name' has already been created"
+ || confess "The type constraint '$name' has already been created "
if defined $name && exists $TYPES{$name};
$parent = find_type_constraint($parent) if defined $parent;
my $constraint = Moose::Meta::TypeConstraint->new(