When you say global, do you mean a lexical with package or file-level scope or do you mean a true global accessible through the symbol table?
If the former, as I suspect, then Perl's reference counting GC may be tripping you up. In that case, every subroutine that refers to a lexical in an outer scope is a closure and increases the refcount of the lexical. At shutdown time, when Perl GCs the subroutines themselves, that reference count decreases.
It sounds to me like you need a separate finalize() method to call explicitly, rather than waiting for DESTROY(). That way, you can avoid the rather messy and unspecified order of destruction errors I think you're having.
Perl's global destruction is a race for the exit. Who knows what order things will happen?
In reply to Re: Global objects and GC
by chromatic
in thread Global objects and GC
by oyasuminasai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |