From: Shawn M Moore Date: Sun, 2 Nov 2008 16:39:16 +0000 (+0000) Subject: If we have nothing left to do for the accessor, we can return during set X-Git-Tag: 0.19~155 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=35e1cb90fe818a9c3f70840ce8b47955ee6f4264;p=gitmo%2FMouse.git If we have nothing left to do for the accessor, we can return during set --- diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 6530166..5d91002 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -84,7 +84,10 @@ sub generate_accessor { }' . "\n" } - $accessor .= $self . '->{'.$key.'} = '. $value .';' . "\n"; + $accessor .= 'return ' + if !$attribute->is_weak_ref + && !$trigger + && !$attribute->should_auto_deref; if ($attribute->is_weak_ref) { $accessor .= 'weaken('.$self.'->{'.$key.'}) if ref('.$self.'->{'.$key.'});' . "\n";