diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-06-26 21:12:18 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-06-28 03:06:08 -0500 |
commit | 67288365cab33e76a48b697c001c11d4dc5b1912 (patch) | |
tree | 8d612e9bb96382ad1b99581ae81e4f2a7356828b /lib/overload.pm | |
parent | 591097e07a9ddfd1783a99ea394ab7e4113242b3 (diff) | |
download | perl-67288365cab33e76a48b697c001c11d4dc5b1912.tar.gz |
propagate context into overloads [perl #47119]
amagic_call now does its best to propagate the operator's context into
the overload callback. It's not always possible - for instance,
dereferencing and stringify/boolify/numify always have to return a
value, even if it's not used, due to the way the overload callback works
in those cases - but the majority of cases should now work. In
particular, overloading <> to handle list context properly is now
possible.
For backcompat reasons (amagic_call and friends are technically public
api functions), list context will not be propagated unless specifically
requested via the AMGf_want_list flag. If this is passed, and the
operator is called in list context, amagic_call returns an AV* holding
all of the returned values instead of an SV*. Void context always
results in amagic_call returning &PL_sv_undef.
Diffstat (limited to 'lib/overload.pm')
-rw-r--r-- | lib/overload.pm | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/overload.pm b/lib/overload.pm index c1eefc018d..deb0b1a0f2 100644 --- a/lib/overload.pm +++ b/lib/overload.pm @@ -1,6 +1,6 @@ package overload; -our $VERSION = '1.19'; +our $VERSION = '1.20'; %ops = ( with_assign => "+ - * / % ** << >> x .", @@ -496,9 +496,6 @@ If C<E<lt>E<gt>> is overloaded then the same implementation is used for both the I<read-filehandle> syntax C<E<lt>$varE<gt>> and I<globbing> syntax C<E<lt>${var}E<gt>>. -B<BUGS> Even in list context, the iterator is currently called only -once and with scalar context. - =item * I<File tests> The key C<'-X'> is used to specify a subroutine to handle all the |