(F) This machine doesn't implement the select() system call.
-=item Self-ties are not supported
+=item Self-ties of arrays and hashes are not supported
-(F) Self-ties are not supported in the current implementation.
+(F) Self-ties are of arrays and hashes are not supported in
+the current implementation.
=item Semicolon seems to be missing
POPSTACK;
if (sv_isobject(sv)) {
sv_unmagic(varsv, how);
- /* Croak if a self-tie is attempted */
- if (varsv == SvRV(sv))
- Perl_croak(aTHX_ "Self-ties are not supported");
+ /* Croak if a self-tie on an aggregate is attempted. */
+ if (varsv == SvRV(sv) &&
+ (SvTYPE(sv) == SVt_PVAV ||
+ SvTYPE(sv) == SVt_PVHV))
+ Perl_croak(aTHX_
+ "Self-ties of arrays and hashes are not supported");
sv_magic(varsv, sv, how, Nullch, 0);
}
LEAVE;
untie %H;
EXPECT
########
-
-# verify no leak when underlying object is selfsame tied variable
-my ($a, $b);
+# Forbidden aggregate self-ties
+my ($a, $b) = (0, 0);
sub Self::TIEHASH { bless $_[1], $_[0] }
-sub Self::DESTROY { $b = $_[0] + 0; }
+sub Self::DESTROY { $b = $_[0] + 1; }
+{
+ my %c = 42;
+ tie %c, 'Self', \%c;
+}
+EXPECT
+Self-ties of arrays and hashes are not supported
+########
+# Allowed scalar self-ties
+my ($a, $b) = (0, 0);
+sub Self::TIESCALAR { bless $_[1], $_[0] }
+sub Self::DESTROY { $b = $_[0] + 1; }
{
- my %b5;
- $a = \%b5 + 0;
- tie %b5, 'Self', \%b5;
+ my $c = 42;
+ $a = $c + 0;
+ tie $c, 'Self', \$c;
}
-die unless $a == $b;
+die unless $a == 0 && $b == 43;
EXPECT
-Self-ties are not supported
########
# Interaction of tie and vec