Make __DATA__ use the right pkg
authorFather Chrysostomos <sprout@cpan.org>
Sun, 25 Aug 2013 00:50:52 +0000 (17:50 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 25 Aug 2013 19:12:35 +0000 (12:12 -0700)
commit83694831aa716521294be467d8300a4e0ae7ff02
treec2c1a7880c795314601ae7214211ec1e09f73aa8
parent93980676cbda10e39b96c327c2c5c912138965d4
Make __DATA__ use the right pkg

__DATA__ is supposed to stuff the rest of the file into the DATA han-
dle belonging to the package in scope where __DATA__ is encountered.
That means this should always print 123:

print <DATA>;
__DATA__
123

But it fails if the package has been renamed through glob assignment:

package foo;
BEGIN{*foo::=*bar::}
print <DATA>;
__DATA__
123

(Prints nothing.)

The code for stuffing DATA was stringifying the package and then look-
ing it up again.  Not only is it more correct to avoid the stringifi-
cation, but faster, too.
t/io/data.t
toke.c