in reply to (in cleanup)
Once Perl is done destroying any lexicals, it stops trying to be well-ordered and instead goes for speed and deletes all remaining objects in some order that it finds fast.
This means that if you have an object that survives that long and that depends on another object, then you are likely to see those objects destroyed in the wrong order. This only happens during "global destruction".
So if you can avoid having objects in global variables, referenced (even indirectly) from global variables, or used in closures (though newer versions of Perl probably destroy some closures sooner -- I haven't checked) then you can avoid this problem.
I'm glad you found a solution to the problem, but I wanted to explain the source of it.
- tye
|
|---|