diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-05-24 12:45:58 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-07 08:18:51 -0700 |
commit | 44b7e78a9416df5de92da12988790f8e11c1b6f4 (patch) | |
tree | 770225ac45d17b82ef0485ecc2f13c1a5afe072b /pp_sys.c | |
parent | 2d1ebc9b3f82056c2c09ae5e780fff582bd5d5dc (diff) | |
download | perl-44b7e78a9416df5de92da12988790f8e11c1b6f4.tar.gz |
Use the same top format error for ""
See also the previous commit.
2dd78f96 added the ‘Undefined top format called’ message for those
cases where a GV doesn’t have a name. That was a bug that used to
happen with *{$io}, which can’t happen any more.
The code that 2dd78f96 added ended up changing a zero-length name to
be treated the same way as no name. It also checked the length by
cheating and checking the first character instead.
Now that we have support for embedded nulls, that logic ends up wrong
for names like "\0foo". And there is no need to treat "" differently
from "foo" anyway.
So this patch restores things the way they were before 2dd78f96.
It also improves the tests for ‘Undefined format’.
Writing tests for ‘Undefined top format’ was quite painful, as that
error seems to leave the internal state out of synch. I suspect
PL_formtarget needs to be localised, or the error just needs to come
earlier in pp_leavewrite. But I’ll save that for later, or for Dave
Mitchell. :-)
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -1452,10 +1452,7 @@ PP(pp_leavewrite) if (!cv) { SV * const sv = sv_newmortal(); gv_efullname4(sv, fgv, NULL, FALSE); - if (SvPOK(sv) && *SvPV_nolen_const(sv)) - DIE(aTHX_ "Undefined top format \"%"SVf"\" called", SVfARG(sv)); - else - DIE(aTHX_ "Undefined top format called"); + DIE(aTHX_ "Undefined top format \"%"SVf"\" called", SVfARG(sv)); } return doform(cv, gv, PL_op); } |