Make sure that Int rejects "1\n" and "\n1" (but Num does accept it)
[gitmo/Moose.git] / lib / Moose / Util / TypeConstraints / Builtins.pm
index e232e5d..485ae05 100644 (file)
@@ -65,7 +65,7 @@ sub define_builtins {
 
     subtype 'Int'
         => as 'Num'
-        => where { "$_" =~ /^-?[0-9]+$/ }
+        => where { "$_" =~ /\A-?[0-9]+\z/ }
         => inline_as {
             return (  qq{defined $_[1]}
                     . qq{&& ! ref $_[1]}