From: Shawn M Moore Date: Tue, 10 Jun 2008 02:58:26 +0000 (+0000) Subject: Moose compat: lazy-no-default error message X-Git-Tag: 0.04~63 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4eb1339a32ef811a7f9a8045261113588565162b;p=gitmo%2FMouse.git Moose compat: lazy-no-default error message --- diff --git a/lib/Mouse/Attribute.pm b/lib/Mouse/Attribute.pm index b5dfb1d..de19f3c 100644 --- a/lib/Mouse/Attribute.pm +++ b/lib/Mouse/Attribute.pm @@ -140,7 +140,7 @@ sub generate_handles { sub create { my ($self, $class, $name, %args) = @_; - confess "You must specify a default for lazy attribute '$name'" + confess "You cannot have lazy attribute ($name) without specifying a default value for it" if $args{lazy} && !exists($args{default}) && !exists($args{builder}); confess "Trigger is not allowed on read-only attribute '$name'" diff --git a/t/011-lazy.t b/t/011-lazy.t index 168eaf1..2d87867 100644 --- a/t/011-lazy.t +++ b/t/011-lazy.t @@ -27,7 +27,7 @@ do { is => 'rw', lazy => 1, ); - } qr/You must specify a default for lazy attribute 'lazy_no_default'/; + } qr/You cannot have lazy attribute \(lazy_no_default\) without specifying a default value for it/; }; my $object = Class->new;