Allow clobbering of a PerlIO::Scalar and more tests
[p5sagit/p5-mst-13.2.git] / ext / PerlIO / Scalar / Scalar.xs
index 9e9412a..a4203bf 100644 (file)
@@ -44,6 +44,8 @@ PerlIOScalar_pushed(PerlIO *f, const char *mode, SV *arg)
    s->posn = SvCUR(SvRV(arg));
  else
    s->posn = 0;
+ if ((PerlIOBase(f)->flags) & PERLIO_F_TRUNCATE)
+   SvCUR(SvRV(arg)) = 0;
  return code;
 }