Message-Id: <
20030908101908.5571326d.rgarcia@hexaflux.com>
p4raw-id: //depot/perl@21073
* or the _name_ of the scalar
*/
if (arg) {
- if (SvROK(arg)) {
+ if (SvROK(arg) && SvTYPE(SvRV(arg)) > SVt_NULL) {
s->var = SvREFCNT_inc(SvRV(arg));
if (!SvPOK(s->var))
(void)SvPV_nolen(s->var);
}
$| = 1;
-print "1..24\n";
+print "1..25\n";
my $fh;
my $var = "ok 2\n";
{ package P; sub TIESCALAR {bless{}} sub FETCH {"ok 24\n"} }
tie $p, P; open $fh, '<', \$p;
print <$fh>;
+
+# don't warn when writing to an undefined scalar
+
+{
+ use warnings;
+ my $ok = 1;
+ local $SIG{__WARN__} = sub { $ok = 0; };
+ open my $fh, '>', \my $scalar;
+ print $fh "foo";
+ close $fh;
+ print $ok ? "ok 25\n" : "not ok 25\n";
+}