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 /pp_sys.c | |
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 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -363,7 +363,7 @@ PP(pp_glob) * is called once and only once */ if (SvGMAGICAL(TOPm1s)) TOPm1s = sv_2mortal(newSVsv(TOPm1s)); - tryAMAGICunTARGET(iter_amg, -1, (PL_op->op_flags & OPf_SPECIAL)); + tryAMAGICunTARGETlist(iter_amg, -1, (PL_op->op_flags & OPf_SPECIAL)); if (PL_op->op_flags & OPf_SPECIAL) { /* call Perl-level glob function instead. Stack args are: |