This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use the same top format error for ""
authorFather Chrysostomos <sprout@cpan.org>
Thu, 24 May 2012 19:45:58 +0000 (12:45 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 7 Jun 2012 15:18:51 +0000 (08:18 -0700)
commit44b7e78a9416df5de92da12988790f8e11c1b6f4
tree770225ac45d17b82ef0485ecc2f13c1a5afe072b
parent2d1ebc9b3f82056c2c09ae5e780fff582bd5d5dc
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. :-)
pp_sys.c
t/op/write.t
t/porting/diag.t