package main;
$| = 1;
-use Test::More tests=>503;
+use Test::More tests => 509;
$a = new Oscalar "087";
ok(!$b, "Expect overloaded boolean");
ok(!$a, "Expect overloaded boolean");
}
+{
+ use Scalar::Util 'weaken';
+
+ package Shklitza;
+ use overload '""' => sub {"CLiK KLAK"};
+
+ package Ksshfwoom;
+ use overload '""' => sub {"OOOKK AWK"};
+
+ package main;
+
+ my ($obj, $ref);
+ $obj = bless do {my $a; \$a}, 'Shklitza';
+ $ref = $obj;
+
+ is ($obj, "CLiK KLAK");
+ is ($ref, "CLiK KLAK");
+
+ weaken $ref;
+ is ($ref, "CLiK KLAK");
+
+ bless $obj, 'Ksshfwoom';
+
+ is ($obj, "OOOKK AWK");
+ is ($ref, "OOOKK AWK");
+
+ undef $obj;
+ is ($ref, undef);
+}