in reply to Order of END blocks

According to perldoc perlmod:

You may have multiple "END" blocks within a file--they will execute in reverse order of definition; that is: last in, first out (L +IFO).

I'm pretty sure what "package" the end blocks are defined in does not matter. They are executed purely in the reverse order of definition, as the documentation says.

Does this answer your question?

Replies are listed 'Best First'.
Re: Re: Order of END blocks
by saintmike (Vicar) on May 28, 2004 at 18:49 UTC
    Let's split it up into two files, then, here's SomeModule.pm:
    # SomeModule.pm package SomeModule; END { print "End of SomeModule\n"; } 1;
    And here's a test script test.pl:
    # test.pl use SomeModule; END { print "End of main\n"; }
    Any way to jump in after SomeModule's END block?
      Yes, and Zaxo has it right. If you want one end block to execute after another, it must be defined before the other. The packages or file separation are insignificant.