[Moose-commits] r7515 - Mouse/trunk/lib/Mouse/Meta

sartak at code2.0beta.co.uk sartak at code2.0beta.co.uk
Tue Feb 3 21:52:03 GMT 2009


Author: sartak
Date: 2009-02-03 13:52:02 -0800 (Tue, 03 Feb 2009)
New Revision: 7515

Modified:
   Mouse/trunk/lib/Mouse/Meta/Attribute.pm
Log:
Benchmarking indicates that exists($_[1]) is faster than scalar(@_) >= 2

Modified: Mouse/trunk/lib/Mouse/Meta/Attribute.pm
===================================================================
--- Mouse/trunk/lib/Mouse/Meta/Attribute.pm	2009-02-03 21:14:24 UTC (rev 7514)
+++ Mouse/trunk/lib/Mouse/Meta/Attribute.pm	2009-02-03 21:52:02 UTC (rev 7515)
@@ -75,7 +75,7 @@
 
     my $accessor = "sub {\n";
     if ($attribute->_is_metadata eq 'rw') {
-        $accessor .= 'if (scalar(@_) >= 2) {' . "\n";
+        $accessor .= 'if (exists $_[1]) {' . "\n";
 
         my $value = '$_[1]';
 




More information about the Moose-commits mailing list