summaryrefslogtreecommitdiff
path: root/t/op/select.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-24 23:35:52 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-24 23:35:52 -0800
commit0df2568b7d017f31f412f393b443d798ed61602d (patch)
tree2bacfabdb7525b985583dfb1deff9344cf695799 /t/op/select.t
parent204263bc1eb63f1dfd6180c05dca8cec2c319504 (diff)
downloadperl-0df2568b7d017f31f412f393b443d798ed61602d.tar.gz
select() can return undef when defoutgv is set
If PL_defoutgv has been deleted from its stash, select() returns it as a ref, but if the stash has been freed (even though the gv still exists), it returns undef. That makes no sense. This is one of those nice cases where simplifying the code fixes a bug.
Diffstat (limited to 't/op/select.t')
-rw-r--r--t/op/select.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/select.t b/t/op/select.t
index 06caf1ddfd..1994dd2131 100644
--- a/t/op/select.t
+++ b/t/op/select.t
@@ -5,7 +5,7 @@ BEGIN {
require './test.pl';
}
-plan reverse 8;
+plan reverse 9;
open my $fh, "test.pl" or die "$0 unfortunately cannot open test.pl: $!";
@@ -25,3 +25,10 @@ $stash = \%foo::;
*foo:: = *bar::;
is select, $handle,
'select returns ref for glob whose stash has been detached';
+
+open thwat::snin, "test.pl" or die "$0 is unable to open test.pl: $!";
+select thwat::snin;
+$handle = \*thwat::snin;
+*thwat:: = *snin::; # gv is now *__ANON__::snin
+is select, $handle,
+ 'select returns ref for glob with no stash pointer';