From: Shawn M Moore Date: Tue, 10 Jun 2008 04:15:05 +0000 (+0000) Subject: Finish the use of overload::StrVal, in verify_type_constraint X-Git-Tag: 0.04~52 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f3e05dfdd5e7f41de2e6caad94c8adb017eb2a5a;p=gitmo%2FMouse.git Finish the use of overload::StrVal, in verify_type_constraint --- diff --git a/lib/Mouse/Attribute.pm b/lib/Mouse/Attribute.pm index a2569d4..6a8c888 100644 --- a/lib/Mouse/Attribute.pm +++ b/lib/Mouse/Attribute.pm @@ -207,8 +207,8 @@ sub verify_type_constraint { return 1 if $constraint->($_); my $name = $self->name; - local $_ = "undef" unless defined($_); - Carp::confess("Attribute ($name) does not pass the type constraint because: Validation failed for \'$type\' failed with value $_"); + my $display = defined($_) ? overload::StrVal($_) : 'undef'; + Carp::confess("Attribute ($name) does not pass the type constraint because: Validation failed for \'$type\' failed with value $display"); } sub _canonicalize_handles {