juniorfoo has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Does anyone out there know if setting PERL_DESTRUCTOR_LEVEL to 2 does anything different from setting it to say 3 or 4? Or is it just a non-zero check? Thanks in advance for any help. Joe

Replies are listed 'Best First'.
Re: Destructor Level
by theorbtwo (Prior) on Sep 14, 2002 at 02:04 UTC

    IIRC, PERL_DESTRUCTOR_LEVEL is a #define that sets how many passes perl makes at trying to destroy things in order when the interpreter ends normaly, before destroying things out of order (or just killing them -- I don't recall which).

    Strangely, google and perldoc.com don't show any hits for PERL_DESTRUCTOR_LEVEL -- try greping the perl source for it, and reading nearby comments.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

      Actually, I grep'd for it in both 5.8 and 5.6.1 sources before I answered. No hits. It seems the reason for that is that the define in question is PERL_DESTRUCT_LEVEL rather than PERL_DESTRUCTOR_LEVEL. I should have been a little more general with my grep the first time, I suppose.

      -sauoq
      "My two cents aren't worth a dime.";
      
Re: Destructor Level
by sauoq (Abbot) on Sep 14, 2002 at 17:40 UTC

    It seems you are talking about PERL_DESTRUCT_LEVEL rather than PERL_DESTRUCTOR_LEVEL. Thank theorbtwo for motivating a more thorough search.

    You can find more out about it by reading the perlhack.pod that comes with 5.8. In short, setting it to two should allow you to see what memory perl is expecting to be cleaned up at exit() and hasn't explicitly cleaned up itself.

    If you are asking in reference to mod_perl, it seems the apache module uses the same variable for other stuff. Read the mod_perl docs for info.

    -sauoq
    "My two cents aren't worth a dime.";
    
Re: Destructor Level
by sauoq (Abbot) on Sep 13, 2002 at 23:06 UTC

    It... uh... doesn't do anything different for me. ;-)

    What are you talking about anyway? Is that supposed to be an environment variable, a compile time define, a variable in some specific script, or something else entirely?

    I don't think I've ever heard of it.

    -sauoq
    "My two cents aren't worth a dime.";