use Test::More qw(no_plan); use Y; my $garbage_collected; *Y::DESTROY = sub { $garbage_collected = 1 }; { my $y = Y->new; }; ok($garbage_collected, "no memory-leak\n");