summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-01-30 13:42:56 +0000
committerNicholas Clark <nick@ccl4.org>2006-01-30 13:42:56 +0000
commitf9d52e31c1813ca7a3cf9d975dc34f04194d1328 (patch)
treeb3e1a2c046ea4fde5afcf0040576d488cf910737
parent25909821eb3e0c6b8049a206da47b68b90d7e46a (diff)
downloadperl-f9d52e31c1813ca7a3cf9d975dc34f04194d1328.tar.gz
Code assumes that *FOO{SCALAR} will always return a scalar reference,
so make it so, creating $FOO if necessary. (Effectively this is a policy decision that PERL_DONT_CREATE_GVSV is visible to XS code, but isn't visible to Perl code) p4raw-id: //depot/perl@27002
-rw-r--r--pp.c2
-rwxr-xr-xt/op/gv.t15
2 files changed, 15 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 9676ce6501..96d5ef6a24 100644
--- a/pp.c
+++ b/pp.c
@@ -607,7 +607,7 @@ PP(pp_gelem)
break;
case 'S':
if (strEQ(second_letter, "CALAR"))
- tmpRef = GvSV(gv);
+ tmpRef = GvSVn(gv);
break;
}
}
diff --git a/t/op/gv.t b/t/op/gv.t
index cf4108a75b..2230baf51c 100755
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -12,7 +12,7 @@ BEGIN {
use warnings;
require './test.pl';
-plan( tests => 132 );
+plan( tests => 134 );
# type coersion on assignment
$foo = 'foo';
@@ -393,6 +393,19 @@ foreach my $value ([1,2,3], {1=>2}, *STDOUT{IO}, \&ok, *STDOUT{FORMAT}) {
like ($@, qr/^Cannot convert a reference to $type to typeglob/,
"Cannot upgrade ref-to-$type to typeglob");
}
+
+{
+ no warnings qw(once uninitialized);
+ my $g = \*clatter;
+ my $r = eval {no strict; ${*{$g}{SCALAR}}};
+ is ($@, '', "PERL_DONT_CREATE_GVSV shouldn't affect thingy syntax");
+
+ $g = \*vowm;
+ $r = eval {use strict; ${*{$g}{SCALAR}}};
+ is ($@, '',
+ "PERL_DONT_CREATE_GVSV shouldn't affect thingy syntax under strict");
+}
+
__END__
Perl
Rules