This fails starting from perl 5.24.
use Test::More;
my $tests;
-BEGIN { $tests = 17 }
+BEGIN { $tests = 18 }
plan tests => $tests;
}
}
+SKIP: {
+ skip "Called twice starting from perl 5.24" => 1 if "$]" >= 5.024;
+
+ my $recasted = 0;
+
+ my $wiz2 = wizard;
+ my $wiz1 = wizard free => sub { ++$recasted; &cast($_[0], $wiz2); die 'xxx' };
+
+ local $@;
+ my $res = eval {
+ my $v = do { my $val = 123; \$val };
+ &cast($v, $wiz1);
+ };
+
+ is $recasted, 1, 'recasting free callback called only once';
+}
+
eval q[
use lib 't/lib';
BEGIN { require Variable::Magic::TestDestroyRequired; }