}
}
-use Test::More tests => 29;
+use Test::More tests => 33;
my $foo;
+my @foo;
+my %foo;
ok( !Internals::SvREADONLY $foo );
ok( Internals::SvREADONLY $foo, 1 );
}
is( Internals::SvREFCNT($foo), 1 );
+is( Internals::SvREFCNT(@foo), 1 );
+is( Internals::SvREFCNT($foo[2]), 1 );
+is( Internals::SvREFCNT(%foo), 1 );
+is( Internals::SvREFCNT($foo{foo}), 1 );
+
XSRETURN(1);
}
-XS(XS_Internals_SvREADONLY)
+XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */
{
dXSARGS;
SV *sv = SvRV(ST(0));
XSRETURN_YES;
}
else {
+ /* I hope you really know what you are doing. */
SvREADONLY_off(sv);
XSRETURN_NO;
}
}
- XSRETURN_UNDEF;
+ XSRETURN_UNDEF; /* Can't happen. */
}
-XS(XS_Internals_SvREFCNT)
+XS(XS_Internals_SvREFCNT) /* This is dangerous stuff. */
{
dXSARGS;
SV *sv = SvRV(ST(0));
if (items == 1)
- XSRETURN_IV(SvREFCNT(sv) - 1); /* minus the SvRV above */
+ XSRETURN_IV(SvREFCNT(sv) - 1); /* Minus the ref created for us. */
else if (items == 2) {
+ /* I hope you really know what you are doing. */
SvREFCNT(sv) = SvIV(ST(1));
XSRETURN_IV(SvREFCNT(sv));
}
- XSRETURN_UNDEF;
+ XSRETURN_UNDEF; /* Can't happen. */
}