in reply to Re: Re: Re: Execution order of END/CHECK vs BEGIN/INIT
in thread Execution order of END/CHECK vs BEGIN/INIT

But that's quite opposite of what's usually happening. If you have:
package A; use B; BEGIN { ... } END { ... }

Then the BEGIN blocks of B are run before the one's in A (because the compiler sees them earlier), while the END blocks of A are run after any END blocks of B (because the compiler sees the one in A after the one's in B).

Replies are listed 'Best First'.
Re: Re: Execution order of END/CHECK vs BEGIN/INIT
by hossman (Prior) on Jun 27, 2003 at 22:32 UTC

    true.

    But that's still the BEGIN-in-FIFO/END-in-LIFO that that was being discussed. My point was more to the fact that since this...

    package A; BEGIN { ... $a ... } // A's 0th BEGIN use B $a; END { ... } // A's 0th END
    ...is basically this...
    package A; BEGIN { ... } // A's 0th BEGIN BEGIN { require B; import B $a } // A's 1st BEGIN END { ... } // A's 0th END

    ...you really want to make sure that A's 0th BEGIN block, happens before it's 1st BEGIN block (which so happens to get executed before B's 0th BEGIN block -- if it has one.)

      I don't think the OP was wondering about the FIFO-ness of BEGIN, but more about the LIFO-ness of END and CHECK.

      Abigail

        I think the OP was wondering about the LIFO-ness of END and CHECK.

        Quite right. I'm willing to accept that there is a "good" reason to make CHECK and END be LIFO; I'm just wondering what that good reason is.

        blyman
        setenv EXINIT 'set noai ts=2'