Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Order of END blocks

by meetraz (Hermit)
on May 28, 2004 at 18:32 UTC ( [id://357327]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://357327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-25 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found