summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-21 11:59:44 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-25 14:24:36 -0700
commitce0b554bf53c768c04939d95a2e6b23356a045b0 (patch)
treea45b49a4116aed4454c29095fdcd727ec8350b23 /pp.c
parentc2f922f11b8978a4eea0e0d28626dd3c1f6eaba7 (diff)
downloadperl-ce0b554bf53c768c04939d95a2e6b23356a045b0.tar.gz
&CORE::caller()
This commit allows &CORE::caller to be called through references and via ampersand syntax. pp_caller is modified to take into account two things: 1) pp_coreargs pushes a null on to the stack, since it has no other way to tell caller whether it has an argument. 2) The value coming from pp_coreargs (when not null) is off by one. The OPpOFFYBONE flag was added in commit 93f0bc4935 for this purpose. pp_coreargs is also modified, since it assumed till now that an optional first argument was an implicit $_.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 04e4e4afd8..7cffe23aa2 100644
--- a/pp.c
+++ b/pp.c
@@ -6010,6 +6010,7 @@ PP(pp_coreargs)
{
dSP;
int opnum = SvIOK(cSVOP_sv) ? (int)SvUV(cSVOP_sv) : 0;
+ int defgv = PL_opargs[opnum] & OA_DEFGV;
AV * const at_ = GvAV(PL_defgv);
SV **svp = AvARRAY(at_);
I32 minargs = 0, maxargs = 0, numargs = AvFILLp(at_)+1, whicharg = 0;
@@ -6048,7 +6049,7 @@ PP(pp_coreargs)
PUTBACK; /* The code below can die in various places. */
oa = PL_opargs[opnum] >> OASHIFT;
- if (!numargs) {
+ if (!numargs && defgv) {
PERL_SI * const oldsi = PL_curstackinfo;
I32 const oldcxix = oldsi->si_cxix;
CV *caller;