projects
/
gitmo/Mouse.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
(parent:
b5fadb9
)
Benchmarking indicates that exists($_[1]) is faster than scalar(@_) >= 2
Shawn M Moore [Tue, 3 Feb 2009 21:52:02 +0000 (21:52 +0000)]
lib/Mouse/Meta/Attribute.pm
patch
|
blob
|
blame
|
history
diff --git
a/lib/Mouse/Meta/Attribute.pm
b/lib/Mouse/Meta/Attribute.pm
index
ab72881
..
dec1300
100644
(file)
--- a/
lib/Mouse/Meta/Attribute.pm
+++ b/
lib/Mouse/Meta/Attribute.pm
@@
-75,7
+75,7
@@
sub generate_accessor {
my $accessor = "sub {\n";
if ($attribute->_is_metadata eq 'rw') {
- $accessor .= 'if (scalar(@_) >= 2) {' . "\n";
+ $accessor .= 'if (exists $_[1]) {' . "\n";
my $value = '$_[1]';