BEGIN and END blocks

BEGIN and END blocks are a powerful feature in PerlEx. Any code you have in a BEGIN block will be executed only when the script is first compiled. Code in an END block will be executed only when the PerlEx DLL is unloaded, due to server shutdown or inactivity, or if you use either the Reload or ReloadAll functions in your program. Remember, if you put an ordinary Perl exit statement into your PerlEx script, the END block will not be executed.

For more information, please see:

Managing Persistent Connections