summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-24 23:31:28 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-24 23:32:41 -0700
commit46e00a91c0fa7d86de7f65504ba0a402c422d58b (patch)
tree80b77a8bbb9a14b780485c7a2a77a706630a946e /gv.c
parentc086f97a1425c2aa61dd3625b890e1236b1d4bc4 (diff)
downloadperl-46e00a91c0fa7d86de7f65504ba0a402c422d58b.tar.gz
Allow ampersand calls to CORE subs with (_) proto
This commit adds all subs with a (_) prototype to the list of those that can be called with ampersand syntax or through references. These have bodies like this: $ ./perl -Ilib -MO=Concise,CORE::abs -e 'BEGIN{\&CORE::abs}' CORE::abs: 3 <1> leavesub[1 ref] K/REFC,1 ->(end) 2 <1> abs[t1] sK/1 ->3 1 <$> coreargs(IV 111) s ->2 -e syntax OK coreargs fetches the caller’s $_ if there are no arguments passed.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/gv.c b/gv.c
index 55dbd4706f..a4cfbb00db 100644
--- a/gv.c
+++ b/gv.c
@@ -1353,15 +1353,21 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
case KEY_or: case KEY_x: case KEY_xor:
return gv;
case KEY___FILE__: case KEY___LINE__: case KEY___PACKAGE__:
- case KEY_break:
- case KEY_continue: case KEY_endgrent: case KEY_endhostent:
+ case KEY_abs: case KEY_alarm: case KEY_chr: case KEY_chroot:
+ case KEY_break: case KEY_continue: case KEY_cos:
+ case KEY_endgrent: case KEY_endhostent:
case KEY_endnetent: case KEY_endprotoent: case KEY_endpwent:
- case KEY_endservent: case KEY_getgrent: case KEY_gethostent:
+ case KEY_endservent: case KEY_exp:
+ case KEY_getgrent: case KEY_gethostent:
case KEY_fork:
case KEY_getlogin: case KEY_getnetent: case KEY_getppid:
case KEY_getprotoent: case KEY_getservent: case KEY_getpwent:
- case KEY_setgrent:
- case KEY_setpwent: case KEY_time: case KEY_times:
+ case KEY_hex: case KEY_int: case KEY_lc: case KEY_lcfirst:
+ case KEY_length: case KEY_log: case KEY_oct: case KEY_ord:
+ case KEY_quotemeta: case KEY_readlink: case KEY_readpipe:
+ case KEY_ref: case KEY_rmdir: case KEY_setgrent:
+ case KEY_setpwent: case KEY_sin: case KEY_sqrt: case KEY_time:
+ case KEY_times: case KEY_uc: case KEY_ucfirst:
case KEY_wait: case KEY_wantarray:
ampable = TRUE;
}
@@ -1419,13 +1425,20 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
break;
}
default:
- o = op_append_elem(OP_LINESEQ, argop,
+ switch (PL_opargs[opnum] & OA_CLASS_MASK) {
+ case OA_BASEOP:
+ o = op_append_elem(
+ OP_LINESEQ, argop,
newOP(opnum,
opnum == OP_WANTARRAY
? OPpOFFBYONE << 8
: 0
)
);
+ break;
+ default:
+ o = newUNOP(opnum,0,argop);
+ }
}
newATTRSUB(oldsavestack_ix,
newSVOP(