in reply to Re: What is safe to do in an END block?
in thread What is safe to do in an END block?

but maybe the module you use for database access has "closed shop" at that time already.

Why would modules spontaneously "close shop"?

Other than making sure the module gets loaded before the END block is compiled, there should be no issue.

  • Comment on Re^2: What is safe to do in an END block?

Replies are listed 'Best First'.
Re^3: What is safe to do in an END block?
by jethro (Monsignor) on Jun 01, 2008 at 11:39 UTC
    Because they had their END block already called and within closed files or dropped connections

    Ok, this is far fetched, but as long as you haven't read the module source code you can't be sure the module writer didn't have same ingenious or dump idea how things could be done better or cleaner. You are relying on a feature the module author never even thought of, an internal detail that just is correct for at least 99% of all modules. And maybe wrong for just the module you are using

      Because they had their END block already called and within closed files or dropped connections

      That's why I said you have to make sure the module is loaded before your END block is compiled. The order in which END blocks are executed is well defined.

      Now it's true the module can shoot itself in the foot — Perl sure has plenty of ways of making that happen — but it can do that whether you use END blocks or not. It's not something you should worry about until you encounter a module with which you have an issue.