From: Yuval Kogman Date: Sat, 18 Apr 2009 14:26:20 +0000 (+0200) Subject: make Num a subtype of Str X-Git-Tag: 0.75~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c29e397835a80ff82cf47000f1edb4b4e95198cb;p=gitmo%2FMoose.git make Num a subtype of Str --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index 7ff43a6..4872917 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -628,7 +628,7 @@ subtype 'Ref' => as 'Defined' => where { ref($_) } => subtype 'Str' => as 'Value' => where {1} => optimize_as \&Moose::Util::TypeConstraints::OptimizedConstraints::Str; -subtype 'Num' => as 'Value' => +subtype 'Num' => as 'Str' => where { Scalar::Util::looks_like_number($_) } => optimize_as \&Moose::Util::TypeConstraints::OptimizedConstraints::Num;