From: gfx Date: Wed, 30 Sep 2009 11:37:55 +0000 (+0900) Subject: Deprecate two internal methods: coerce_constraint() and typecast_constraints() X-Git-Tag: 0.37_01~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e763d56e2b18480328a95cbbe9e9b58988a8c4dc;p=gitmo%2FMouse.git Deprecate two internal methods: coerce_constraint() and typecast_constraints() --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index e87dec4..dffcb22 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -301,6 +301,9 @@ sub verify_type_constraint_error { sub coerce_constraint { ## my($self, $value) = @_; my $type = $_[0]->{type_constraint} or return $_[1]; + + Carp::cluck("coerce_constraint() has been deprecated, which was an internal utility anyway"); + return Mouse::Util::TypeConstraints->typecast_constraints($_[0]->associated_class->name, $type, $_[1]); } diff --git a/lib/Mouse/Util/TypeConstraints.pm b/lib/Mouse/Util/TypeConstraints.pm index 4ebb08a..9705b71 100644 --- a/lib/Mouse/Util/TypeConstraints.pm +++ b/lib/Mouse/Util/TypeConstraints.pm @@ -189,11 +189,12 @@ sub role_type { ); } -# this is an original method for Mouse sub typecast_constraints { my($class, $pkg, $type, $value) = @_; Carp::croak("wrong arguments count") unless @_ == 4; + Carp::cluck("typecast_constraints() has been deprecated, which was an internal utility anyway"); + return $type->coerce($value); }