PV of the scalar it reads from, avoid to read it when it's an
undefined PV.
p4raw-id: //depot/perl@23340
}
SvUPGRADE(s->var, SVt_PV);
code = PerlIOBase_pushed(aTHX_ f, mode, Nullsv, tab);
- if ((PerlIOBase(f)->flags) & PERLIO_F_TRUNCATE)
+ if (!SvOK(s->var) || (PerlIOBase(f)->flags) & PERLIO_F_TRUNCATE)
SvCUR(s->var) = 0;
if ((PerlIOBase(f)->flags) & PERLIO_F_APPEND)
s->posn = SvCUR(s->var);
}
$| = 1;
-print "1..25\n";
+print "1..26\n";
my $fh;
my $var = "ok 2\n";
close $fh;
print $ok ? "ok 25\n" : "not ok 25\n";
}
+
+my $data = "a non-empty PV";
+$data = undef;
+open(MEM, '<', \$data) or die "Fail: $!\n";
+my $x = join '', <MEM>;
+print $x eq '' ? "ok 26\n" : "not ok 26\n";