*/
if (arg && SvOK(arg)) {
if (SvROK(arg)) {
- if (SvREADONLY(SvRV(arg)) && mode && *mode != 'r') {
+ if (SvREADONLY(SvRV(arg)) && !SvIsCOW(SvRV(arg))
+ && mode && *mode != 'r') {
if (ckWARN(WARN_LAYER))
Perl_warner(aTHX_ packWARN(WARN_LAYER), "%s", PL_no_modify);
SETERRNO(EINVAL, SS_IVCHAN);
$| = 1;
-use Test::More tests => 70;
+use Test::More tests => 71;
my $fh;
my $var = "aaa\n";
is read($strIn, my $buffer, 5), 0,
'seek beyond end end of string followed by read';
}
+
+# Writing to COW scalars
+{
+ my $bovid = __PACKAGE__;
+ open my $handel, ">", \$bovid;
+ print $handel "the COW with the crumpled horn";
+ is $bovid, "the COW with the crumpled horn", 'writing to COW scalars';
+}