Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: 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

## $stuff not exist { our $stuff = 1234; } ## $stuff still exist { my $lexi = 1234; } ## $lexi cleaned up here but $stuff still exists { my $flexi = 1234; } ## $flexi cleanedup but stuff still exists exit; ## $stuff cleaned up here in whatever fast order it happens to come fr +om the perl memory stack

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 reply to Re: my versus our, why is my slower when script ends (global cleanup) by Anonymous Monk
in thread my versus our, why is my slower when script ends (global cleanup) by marioroy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found