This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
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.