diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-07-13 18:16:43 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-07-13 19:58:59 -0700 |
commit | 79a3e5ea36208f2f54e36fa3a73c72808a6d0ad8 (patch) | |
tree | 95c6a242ed27ebb6233eeeebf5e53c7bebd44e55 /pp_hot.c | |
parent | dd9a6ccfcb1b5e26680c14c1663ea9fac4480690 (diff) | |
download | perl-79a3e5ea36208f2f54e36fa3a73c72808a6d0ad8.tar.gz |
[perl #113576] Restore err msg for &{+undef}
This ‘Can't use an undefined value as a subroutine reference’ message
used to occur for &{+undef}, until commit 15ff848f77796 in 1997.
Then it started happening only for magic variables.
Non-magical variables would treat it the same as "", possibly dying
with ‘Undefined subroutine main:: called’, and possibly calling the
subroutine with that name.
Magical variables (&{$tied_undef}) started behaving the same way
(treating undef as "") with commit 7c75014e, in 2010.
This commit restores that message.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2601,9 +2601,9 @@ PP(pp_entersub) else { const char *sym; STRLEN len; - sym = SvPV_nomg_const(sv, len); - if (!sym) + if (!SvOK(sv)) DIE(aTHX_ PL_no_usym, "a subroutine"); + sym = SvPV_nomg_const(sv, len); if (PL_op->op_private & HINT_STRICT_REFS) DIE(aTHX_ "Can't use string (\"%" SVf32 "\"%s) as a subroutine ref while \"strict refs\" in use", sv, len>32 ? "..." : ""); cv = get_cvn_flags(sym, len, GV_ADD|SvUTF8(sv)); |