From: Yuval Kogman Date: Sat, 22 Apr 2006 13:37:40 +0000 (+0000) Subject: Ints can also be negative X-Git-Tag: 0_05~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4634ca276c551c6d358cabad05b2a3951977907;p=gitmo%2FMoose.git Ints can also be negative --- diff --git a/lib/Moose/Util/TypeConstraints.pm b/lib/Moose/Util/TypeConstraints.pm index f715727..1f6e888 100644 --- a/lib/Moose/Util/TypeConstraints.pm +++ b/lib/Moose/Util/TypeConstraints.pm @@ -126,7 +126,7 @@ subtype 'Ref' => as 'Defined' => where { ref($_) }; subtype 'Str' => as 'Value' => where { 1 }; subtype 'Num' => as 'Value' => where { Scalar::Util::looks_like_number($_) }; -subtype 'Int' => as 'Num' => where { "$_" =~ /^[0-9]+$/ }; +subtype 'Int' => as 'Num' => where { "$_" =~ /^-?[0-9]+$/ }; subtype 'ScalarRef' => as 'Ref' => where { ref($_) eq 'SCALAR' }; subtype 'ArrayRef' => as 'Ref' => where { ref($_) eq 'ARRAY' };