summaryrefslogtreecommitdiff
path: root/op.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 /op.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 'op.c')
-rw-r--r--op.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/op.c b/op.c
index 02811c622e..973675896b 100644
--- a/op.c
+++ b/op.c
@@ -10364,9 +10364,12 @@ Perl_coresub_op(pTHX_ SV * const coreargssv, const int code,
);
case OA_BASEOP_OR_UNOP:
o = newUNOP(opnum,0,argop);
+ if (opnum == OP_CALLER) o->op_private |= OPpOFFBYONE;
+ else {
onearg:
- if (is_handle_constructor(o, 1))
+ if (is_handle_constructor(o, 1))
argop->op_private |= OPpCOREARGS_DEREF1;
+ }
return o;
default:
o = convert(opnum,0,argop);