![]() |
|
Problems? Is your data what you think it is? | |
PerlMonks |
Re: my versus our, why is my slower when script ends (global cleanup)by Anonymous Monk |
on Apr 22, 2017 at 02:19 UTC ( #1188597=note: print w/replies, xml ) | Need Help?? |
The reason is simple , lexicals (my) are destroyed/destructored/cleanedup in-order Where as, globals are cleaned up during "global destruction" before program exits but not in-order as there is no order they're globals You can short-circuit cleanup with POSIX::exit() for even faster exit, but then destructors and stuff dont ... Example
There are discussions on this just search for global destruction order, site:perlmonks.org global destruction order see sub DESTROY: Strange ordering of object destruction (global destruction order not guaranteed, Re^3: when is destroy function called ( perl -d:Trace dalek ), Re^2: Perl Gtk2 - ->destroy() is Not Causing the Script to Exit
Why does Perl have this odd behavior during cleanup? Heheh, its always funny when people (me too) say something is odd/weird ... almost as if they're trying to say I know stuff but this doesn't behave like it should (i used to think this but I know better now)... but what they really mean is always I don't know what should be happening, why is there a difference in what is happening, even if they don't think this is what they mean
In Section
Seekers of Perl Wisdom
|
|