From: wu-lee Date: Thu, 2 Apr 2009 14:13:46 +0000 (+0100) Subject: Type coercions should be added to the front of the list in X-Git-Tag: 0.20~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=daa8612f373bda7f7bc493af266535504d25307b;hp=5c5a61e0daea184cff679a815d6fc4cdbe08bc33 Type coercions should be added to the front of the list in $COERCE_KEYS{$name}, not the back. This ensures they are checked in the correct order (as supplied in the declaration). --- diff --git a/lib/Mouse/Util/TypeConstraints.pm b/lib/Mouse/Util/TypeConstraints.pm index 3ed075d..650bfca 100644 --- a/lib/Mouse/Util/TypeConstraints.pm +++ b/lib/Mouse/Util/TypeConstraints.pm @@ -154,7 +154,7 @@ sub coerce { } } - push @{ $COERCE_KEYS{$name} }, $type; + unshift @{ $COERCE_KEYS{$name} }, $type; $COERCE{$name}->{$type} = $code; } }