From: Shawn M Moore Date: Wed, 16 Jul 2008 06:15:18 +0000 (+0000) Subject: Moose error compat X-Git-Tag: 0.19~244 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=97661b774fd00a06d0eecdc17af4c6ca9ff0bee1 Moose error compat --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 370db8a..225ea59 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -267,10 +267,10 @@ sub validate_args { if ref($args->{default}) && ref($args->{default}) ne 'CODE'; - confess "You cannot auto-dereference without specifying a type constraint on attribute $name" + confess "You cannot auto-dereference without specifying a type constraint on attribute ($name)" if $args->{auto_deref} && !exists($args->{isa}); - confess "You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute $name" + confess "You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute ($name)" if $args->{auto_deref} && $args->{isa} ne 'ArrayRef' && $args->{isa} ne 'HashRef'; diff --git a/t/026-auto-deref.t b/t/026-auto-deref.t index b9a4971..d4b1df5 100644 --- a/t/026-auto-deref.t +++ b/t/026-auto-deref.t @@ -25,7 +25,7 @@ do { is => 'rw', auto_deref => 1, ); - } qr/You cannot auto-dereference without specifying a type constraint on attribute any/; + } qr/You cannot auto-dereference without specifying a type constraint on attribute \(any\)/; ::throws_ok { has scalar => ( @@ -33,7 +33,7 @@ do { isa => 'Value', auto_deref => 1, ); - } qr/You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute scalar/; + } qr/You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute \(scalar\)/; }; my $obj;