From: John Napiorkowski Date: Wed, 29 Oct 2008 15:45:39 +0000 (+0000) Subject: make sure a type constrain name makes sense, properly stringify it and set a default... X-Git-Tag: 0.61~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ec8b7b21a1d1dd4ab2d90c55b80319fad9fdfb8b;p=gitmo%2FMoose.git make sure a type constrain name makes sense, properly stringify it and set a default name to __ANON__ --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index f84b57e..86caaa4 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -373,9 +373,11 @@ sub _create_type_constraint ($$$;$$) { . $pkg_defined_in ) if defined $type; } + + $name = $name ? "$name" : "__ANON__"; my %opts = ( - name => $name || '__ANON__', + name => $name, package_defined_in => $pkg_defined_in, ( $check ? ( constraint => $check ) : () ),