http://www.perlmonks.org?node_id=368834


in reply to How can I write Test::Finished?

Overriding CORE::exit() is probably the simplest thing to do, I'm planning on building that into Test::More once I'm convinced there's a real need. POSIX::_exit() is another one. Override them so they set a flag and check for that flag in an END block (END blocks are still run even when exit()ing).

I don't think there's anything you can do about a direct call to CORE::exit() but that's about as unlikely as they come.

Filters are just asking for trouble.

I've never run into this problem in the real world so I'm less than convinced it needs addressing. Has an exit(0) bitten anyone else?

-- Michael G Schwern