From: Shawn M Moore Date: Fri, 27 Jun 2008 03:38:58 +0000 (+0000) Subject: Small fix to improve coverage, I wish Devel::Cover handled a ||= "true value" X-Git-Tag: 0.19~273 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=028b550b1a533daca23d2ea942a60d90a1380e1f;p=gitmo%2FMouse.git Small fix to improve coverage, I wish Devel::Cover handled a ||= "true value" --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 4791dab..22b87cb 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -22,14 +22,15 @@ sub new { if exists $args{default}; $args{lazy} = 1; $args{required} = 1; - $args{builder} ||= "_build_${name}"; + $args{builder} = "_build_${name}" + if !exists($args{builder}); if ($name =~ /^_/) { - $args{clearer} ||= "_clear${name}"; - $args{predicate} ||= "_has${name}"; - } + $args{clearer} = "_clear${name}" if !exists($args{clearer}); + $args{predicate} = "_has${name}" if !exists($args{predicate}); + } else { - $args{clearer} ||= "clear_${name}"; - $args{predicate} ||= "has_${name}"; + $args{clearer} = "clear_${name}" if !exists($args{clearer}); + $args{predicate} = "has_${name}" if !exists($args{predicate}); } }