diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-16 09:59:23 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-16 12:51:44 -0800 |
commit | 4e1d8790c4dcb682f5b15a9f7f63e2daa0857836 (patch) | |
tree | de3f0c9e335f77dd12f5d7f15594770a9f7bb42d /lib | |
parent | 9f39352cca0692fa842fc77a327a0e496fe638be (diff) | |
download | perl-4e1d8790c4dcb682f5b15a9f7f63e2daa0857836.tar.gz |
overload.pm: Combine two loops
It should go faster if we only iterate through %arg once.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/overload.pm | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/overload.pm b/lib/overload.pm index 222eecd616..64860b1263 100644 --- a/lib/overload.pm +++ b/lib/overload.pm @@ -30,9 +30,6 @@ sub nil {} sub OVERLOAD { $package = shift; my %arg = @_; - for (keys %arg) { - warnings::warnif("overload arg '$_' is invalid") unless $ops_seen{$_}; - } my ($sub, $fb); $ {$package . "::OVERLOAD"}{dummy}++; # Register with magic by touching. $fb = ${$package . "::()"}; # preserve old fallback value RT#68196 @@ -41,6 +38,8 @@ sub OVERLOAD { if ($_ eq 'fallback') { $fb = $arg{$_}; } else { + warnings::warnif("overload arg '$_' is invalid") + unless $ops_seen{$_}; $sub = $arg{$_}; if (not ref $sub and $sub !~ /::/) { $ {$package . "::(" . $_} = $sub; |