summaryrefslogtreecommitdiff
path: root/ext/PerlIO
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-08-11 10:22:36 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-08-11 10:22:36 +0000
commited423f7afb5038546a92d00ca689992f3e08bc61 (patch)
tree13ec0b66c5321344d46a6d63b43a4c0a79759dfb /ext/PerlIO
parentabc0a0153433fe6596e1ca3a6b5572dc424d0f11 (diff)
downloadperl-ed423f7afb5038546a92d00ca689992f3e08bc61.tar.gz
Integrate mainline.
p4raw-id: //depot/perlio@17708
Diffstat (limited to 'ext/PerlIO')
-rw-r--r--ext/PerlIO/scalar/scalar.xs2
-rw-r--r--ext/PerlIO/t/scalar.t7
2 files changed, 8 insertions, 1 deletions
diff --git a/ext/PerlIO/scalar/scalar.xs b/ext/PerlIO/scalar/scalar.xs
index c027bd12d1..7bcee5774e 100644
--- a/ext/PerlIO/scalar/scalar.xs
+++ b/ext/PerlIO/scalar/scalar.xs
@@ -25,6 +25,8 @@ PerlIOScalar_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg,
if (arg) {
if (SvROK(arg)) {
s->var = SvREFCNT_inc(SvRV(arg));
+ if (!SvPOK(s->var))
+ (void)SvPV_nolen(s->var);
}
else {
s->var =
diff --git a/ext/PerlIO/t/scalar.t b/ext/PerlIO/t/scalar.t
index fd1b852657..4e6615e799 100644
--- a/ext/PerlIO/t/scalar.t
+++ b/ext/PerlIO/t/scalar.t
@@ -10,7 +10,7 @@ BEGIN {
}
$| = 1;
-print "1..22\n";
+print "1..23\n";
my $fh;
my $var = "ok 2\n";
@@ -115,3 +115,8 @@ while (<$dup>) {
close($fh);
close($dup);
+# Check reading from non-string scalars
+
+open $fh, '<', \42;
+print <$fh> eq "42" ? "ok 23\n" : "not ok 23\n";
+close $fh;