summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-25 17:59:12 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-25 23:02:09 -0700
commit30901a8a3fcf590cb60375fd3b39c6b0d0bf6e00 (patch)
tree2fe79e70e0e8643f19efbfa4154f2279408f4040 /pp_hot.c
parent64a8239ec9dfc1bed7de64084b6c65e6e05f72f5 (diff)
downloadperl-30901a8a3fcf590cb60375fd3b39c6b0d0bf6e00.tar.gz
&CORE::foo() for close, getc and readline
This commit allows the subs in the CORE package for close, getc and readline to be called through references and via ampersand syntax. The pp functions are modified to take into account the nulls that coreargs pushes on to the stack to indicate that there is no argument.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index b75b263682..6abbf19c8e 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -322,9 +322,13 @@ PP(pp_padsv)
PP(pp_readline)
{
dVAR;
- dSP; SvGETMAGIC(TOPs);
- tryAMAGICunTARGET(iter_amg, 0, 0);
- PL_last_in_gv = MUTABLE_GV(*PL_stack_sp--);
+ dSP;
+ if (TOPs) {
+ SvGETMAGIC(TOPs);
+ tryAMAGICunTARGET(iter_amg, 0, 0);
+ PL_last_in_gv = MUTABLE_GV(*PL_stack_sp--);
+ }
+ else PL_last_in_gv = PL_argvgv, PL_stack_sp--;
if (!isGV_with_GP(PL_last_in_gv)) {
if (SvROK(PL_last_in_gv) && isGV_with_GP(SvRV(PL_last_in_gv)))
PL_last_in_gv = MUTABLE_GV(SvRV(PL_last_in_gv));