diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-06 01:35:38 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-06 02:10:04 -0800 |
commit | 52a6327bb1a7bdbfce3ca5a5bdd9de4531dbaf69 (patch) | |
tree | 8791e2cf0e9c6977adc24b429c230d10da925552 /t/op/gv.t | |
parent | a4a3cf7419a4f30455db08fefe2cac688567ac22 (diff) | |
download | perl-52a6327bb1a7bdbfce3ca5a5bdd9de4531dbaf69.tar.gz |
[perl #96326] *{$io} should not be semi-defined
gv_efullname4 produces undef if the GV points to no stash, instead of
using __ANON__, as it does when the stash has no name.
Instead of going through hoops to try and work around it elsewhere, fix
gv_efullname4.
This means that
$x = *$io;
$x .= "whate’er";
no longer produces an uninitialized warning. (The warning was rather
strange, as defined() returned true.)
This commit also gives the glob the name $__ANONIO__ (yes, with a dol-
lar sign). It may seem a little strange, but there is precedent in
other autovivified globs, such as those open() produces when it cannot
determine the variable name (e.g, open $t->{fh}).
Diffstat (limited to 't/op/gv.t')
-rw-r--r-- | t/op/gv.t | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -598,10 +598,11 @@ foreach my $type (qw(integer number string)) { # RT #60954 anonymous glob should be defined, and not coredump when # stringified. The behaviours are: # -# defined($glob) "$glob" -# 5.8.8 false "" with uninit warning -# 5.10.0 true (coredump) -# 5.12.0 true "" +# defined($glob) "$glob" $glob .= ... +# 5.8.8 false "" with uninit warning "" with uninit warning +# 5.10.0 true (coredump) (coredump) +# 5.1[24] true "" "" with uninit warning +# 5.16 true "*__ANON__::..." "*__ANON__::..." { my $io_ref = *STDOUT{IO}; @@ -613,7 +614,8 @@ foreach my $type (qw(integer number string)) { use warnings; my $str = "$glob"; is($warn, '', "RT #60954 anon glob stringification shouldn't warn"); - is($str, '', "RT #60954 anon glob stringification should be empty"); + is($str, '*__ANON__::$__ANONIO__', + "RT #60954/#96326 anon glob stringification"); } # [perl #71254] - Assigning a glob to a variable that has a current |