[perl #71286] fallback/nomethod failures
authorMichael Breen <perl@mbreen.com>
Tue, 30 Nov 2010 17:48:50 +0000 (17:48 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 3 Dec 2010 12:16:06 +0000 (12:16 +0000)
commitbf5522a13a381257966e7ed6b731195a873b153e
tree97867c011ecfc5dc5d5d50a764fb7078ffd77828
parent4a039ddd5c2357bd4dadf1ccf8ad58c552671247
[perl #71286] fallback/nomethod failures

This fixes two bugs related to overload and fallback on binary ops.

First, if *either* of the args has a 'nomethod', this will now be used;
previously the RH nomethod was ignored if the LH arg had fallback value
of undef or 1.

Second, if neither arg has a 'nomethod', then the fallback to the built-in
op will now only occur if *both* args have fallback => 1; previously it
would do so if the *RHS* had fallback => 1. Clearly the old behaviour was
wrong, but there were two ways to fix this: (a) *both* args have fallback
=> 1; (b) *either* arg has fallback=> 1. It could be argued either way,
but the the choice of 'both' was that classes that hadn't set 'fallback =>
1' were implicitly implying that their objects aren't suitable for
fallback, regardless of the presence of conversion methods.
gv.c
lib/overload.t