From: Dave Rolsky Date: Sun, 10 Apr 2011 23:55:24 +0000 (-0500) Subject: We don't want two different inline code chunks to use the same var names or else... X-Git-Tag: 2.0100~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff1687caea2e5fd271ed854ff0ae95c8355f3f3e;p=gitmo%2FMoose.git We don't want two different inline code chunks to use the same var names or else they can clash and cause a warning This happens in the case of a type union of Str | Int, for example --- diff --git a/lib/Moose/Util/TypeConstraints/Builtins.pm b/lib/Moose/Util/TypeConstraints/Builtins.pm index b595c4a..35c1390 100644 --- a/lib/Moose/Util/TypeConstraints/Builtins.pm +++ b/lib/Moose/Util/TypeConstraints/Builtins.pm @@ -58,7 +58,7 @@ sub define_builtins { => inline_as { return ( qq{defined $_[1]} . qq{&& ( ref(\\ $_[1] ) eq 'SCALAR'} - . qq{ || ref(\\(my \$value = $_[1])) eq 'SCALAR')} ); + . qq{ || ref(\\(my \$str_value = $_[1])) eq 'SCALAR')} ); }; subtype 'Num' @@ -74,7 +74,7 @@ sub define_builtins { => inline_as { return ( qq{defined $_[1]} . qq{&& ! ref $_[1]} - . qq{&& ( my \$value = $_[1] ) =~ /\\A-?[0-9]+\\z/} ); + . qq{&& ( my \$int_value = $_[1] ) =~ /\\A-?[0-9]+\\z/} ); }; subtype 'CodeRef'