From: Fuji, Goro Date: Wed, 10 Nov 2010 06:12:11 +0000 (+0900) Subject: Fix an error message to compatible with Moose X-Git-Tag: 0.85~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2c689df48deeec2e551a24b58558ca370ad24f54;p=gitmo%2FMouse.git Fix an error message to compatible with Moose --- diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index c287ee4..d9626b1 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -589,7 +589,7 @@ sub _process_options{ if ($args->{lazy}) { (exists $args->{default} || defined $args->{builder}) - || $class->throw_error("You cannot have lazy attribute ($name) without specifying a default value for it"); + || $class->throw_error("You cannot have a lazy attribute ($name) without specifying a default value for it"); } return; diff --git a/t/001_mouse/011-lazy.t b/t/001_mouse/011-lazy.t index df584b1..d9b0863 100644 --- a/t/001_mouse/011-lazy.t +++ b/t/001_mouse/011-lazy.t @@ -2,7 +2,6 @@ use strict; use warnings; use Test::More; -use Test::Exception; my $lazy_run = 0; @@ -22,12 +21,13 @@ do { default => "welp", ); - ::throws_ok { + eval { has lazy_no_default => ( is => 'rw', lazy => 1, ); - } qr/You cannot have lazy attribute \(lazy_no_default\) without specifying a default value for it/; + }; + ::like $@, qr/You cannot have a lazy attribute \(lazy_no_default\) without specifying a default value for it/; }; my $object = Class->new; diff --git a/xs-src/MouseAttribute.xs b/xs-src/MouseAttribute.xs index 5e20e92..7a453fd 100644 --- a/xs-src/MouseAttribute.xs +++ b/xs-src/MouseAttribute.xs @@ -476,7 +476,7 @@ CODE: if(svp && sv_true(*svp)){ if(!(has_default || has_builder)){ mouse_throw_error(klass, NULL, - "You cannot have lazy attribute (%"SVf") without specifying " + "You cannot have a lazy attribute (%"SVf") without specifying " "a default value for it", name); } }