diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-05-12 19:05:24 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-05-29 09:36:27 -0700 |
commit | 46bef06f0f3d8f94283e79e8c77eb5bf23d08fc3 (patch) | |
tree | 568f32ac93490666de55137f59b7a9460c5c66a6 /gv.c | |
parent | d80ed30335f69d8f833d3a3facade69b4f16cd2c (diff) | |
download | perl-46bef06f0f3d8f94283e79e8c77eb5bf23d08fc3.tar.gz |
Add &CORE::undef
In the error message, we can’t say ‘&CORE::undef operator’, so we
should be using the op name, rather than the op description.
Instead of using OP_NAME(PL_op->op_next), which would expand to
PL_op->op_next->op_type == OP_CUSTOM
? XopENTRY(Perl_custom_op_xop(aTHX_ PL_op->op_next), xop_name)
: PL_op_name[PL_op->op_next->op_type]
we can simply use PL_op_name[opnum], which should be quicker.
pp_undef can already handle nulls on the stack.
There is one remaining problem. If &CORE::undef(\*_) is called, *_
will be undefined while @_ is localised during the sub call, so it
won’t have the same effect as undef *_. I don’t know whether this
should be considered a bug or not, but I could solve it by making
pp_undef an XSUB.
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -471,7 +471,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv, case KEY_qx : case KEY_redo : case KEY_require: case KEY_return: case KEY_s : case KEY_say : case KEY_sort : case KEY_state: case KEY_sub : - case KEY_tr : case KEY_undef: case KEY_UNITCHECK: case KEY_unless: + case KEY_tr : case KEY_UNITCHECK: case KEY_unless: case KEY_until: case KEY_use : case KEY_when : case KEY_while : case KEY_x : case KEY_xor : case KEY_y : return NULL; |