END { $global = undef; }
That END block is in main/caller's package, not the $global's package. A PM/Class can't control where its instances stored (lex or global). The programmer of the PM doesn't write where the PM is used. Are you suggesting a package weakref list/hash and an END block in the same package in the that destroys all live instances of that package? | [reply] |
That END block is in main/caller's package, not the $global's package
Yes, assuming you mean "ref($global)" by "$global's package".
Are you suggesting a package weakref list/hash and an END block in the same package in the that destroys all live instances of that package?
I was suggesting that if you create a global that's creating a problem, that you cleanup the global you created before it creates the problem.
What you mention could work, but it could also create new instances of the problem you are trying to avoid.
| [reply] |