diff options
author | Father Chrysostomos <sprout@cpan.org> | 2010-07-10 15:09:51 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgs@consttype.org> | 2010-07-26 10:16:55 +0200 |
commit | 0fe688f528b0e1b5bef6fb30d5e45316430e8a41 (patch) | |
tree | a38f5eb47badce81268c3c57df36562d8ac90c91 /t/op | |
parent | 1eb3f3ad74c5c8cb35d027485b9938eb0a64db40 (diff) | |
download | perl-0fe688f528b0e1b5bef6fb30d5e45316430e8a41.tar.gz |
Fix for RT#1804: Anonymous glob breaks when assigned through
The problem here is that globs are scalars and the = operator can only
distinguish between scalar and glob assignments by the flags on the
glob. It only sees the return value of *{}, not the *{} itself. We can
fix this by having the pp_sassign look for a rv2gv (*{}) on its LHS,
to decide what type of assignment to do.
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/gv.t | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -12,7 +12,7 @@ BEGIN { use warnings; require './test.pl'; -plan( tests => 191 ); +plan( tests => 192 ); # type coersion on assignment $foo = 'foo'; @@ -623,6 +623,17 @@ is ($@, '', "Can localize FAKE glob that's present in stash"); is (scalar $::{fake}, "*main::sym", "Localized FAKE glob's value was correctly restored"); +# [perl #1804] *$x assignment when $x is a copy of another glob +{ + no warnings 'once'; + my $x = *_random::glob_that_is_not_used_elsewhere; + *$x = sub{}; + is( + "$x", '*_random::glob_that_is_not_used_elsewhere', + '[perl #1804] *$x assignment when $x is FAKE', + ); +} + __END__ Perl Rules |