in reply to
Re^2: A way to test that circular references are actually freed
in thread A way to test that circular references are actually freed
Here it is in all its alpha status glory. (It needs some formatting and more comments.) It passes a simple test suite, and has handled very complicated structures from another CPAN project (the reason I originally wrote it). I've applied to PAUSE for the name Test::Weaken.
There does seem to be a bug with the count of the total references, but it does not affect the count of freed references, and therefore fail/succeed reporting is unaffected.
UPDATE: I've removed the code. Test::Weaken is now on CPAN and anyone can see the latest version there. It's still alpha, but it has a start in the way of documentation and there are test scripts, which make good examples.
The version in this post did turn out to have the bug mentioned above, which is fixed in the CPAN version. I was reluctant to post the code but senior monks asked more than once to see it, and this humblest and most unworthy of Sextons was unwilling to refuse. Those who really feel they need to look at my first attempts, can look at earliest versions on backpan.