Type coercions should be added to the front of the list in
wu-lee [Thu, 2 Apr 2009 14:13:46 +0000 (15:13 +0100)]
$COERCE_KEYS{$name}, not the back. This ensures they are checked in
the correct order (as supplied in the declaration).

lib/Mouse/Util/TypeConstraints.pm

index 3ed075d..650bfca 100644 (file)
@@ -154,7 +154,7 @@ sub coerce {
             }
         }
 
-        push @{ $COERCE_KEYS{$name} }, $type;
+        unshift @{ $COERCE_KEYS{$name} }, $type;
         $COERCE{$name}->{$type} = $code;
     }
 }