summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-05-24 12:45:58 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-06-07 08:18:51 -0700
commit44b7e78a9416df5de92da12988790f8e11c1b6f4 (patch)
tree770225ac45d17b82ef0485ecc2f13c1a5afe072b /pp_sys.c
parent2d1ebc9b3f82056c2c09ae5e780fff582bd5d5dc (diff)
downloadperl-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.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 0071e3b9cf..3ddf5e2d70 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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);
}