Re: Test::Most::EXIT()

2008-04-23 Thread David Golden
On Wed, Apr 23, 2008 at 5:52 AM, Ovid [EMAIL PROTECTED] wrote:
  I do, however, feel like I'm missing something fundamental, but I can't
  figure out what.

How about:

sub DIE { local $SIG{__DIE__}; die }

or even just sub die and import that into the *.t file and or die
should do what you want.  That might be too much magic, though --
there could possibly be other things in the main package that call
it by mistake.

David


Re: Test::Most::EXIT()

2008-04-23 Thread Michael G Schwern

Ovid wrote:

I'd like advice on how best to implement this.

Currently, because so many module authors thoughtfully break
$SIG{__DIE__}, I routinely find that things like this break:

  ok $foo or die;   # sometimes still exits with zero
# or simply doesn't exit


Is it possible for $SIG{__DIE__} to stop the die?  I don't think it is.  And 
it's extremely rare for a DIE handler to alter the exit code.


Are you sure you're not just running into the old Test::Builder DIE handler 
and exit problems?  Make sure you're using 0.77 or higher.



--
The past has a vote, but not a veto.
-- Mordecai M. Kaplan


Re: Test::Most::EXIT()

2008-04-23 Thread Eric Wilhelm
# from Michael G Schwern
# on Wednesday 23 April 2008 12:28:

Is it possible for $SIG{__DIE__} to stop the die?  I don't think it
 is.

Only with a goto, but some people are rumored to use exit().

What I wonder is how Ovid ended up with a module setting a global die 
handler that wasn't under his direct control and/or couldn't be solved 
with local(), monkeypatching, or a code fork?

--Eric
-- 
The opinions expressed in this e-mail were randomly generated by
the computer and do not necessarily reflect the views of its owner.
--Management
---
http://scratchcomputing.com
---


Re: Test::Most::EXIT()

2008-04-23 Thread Smylers
Eric Wilhelm writes:

 What I wonder is how Ovid ended up with a module setting a global die
 handler that wasn't under his direct control

Why would it being under his control mean he didn't want to test for it?

I've been in situations before where a co-worker has inserted a die
handler into a library, which then broke something which used that
library.  The code was completely under our control; we were able to fix
it.

But it'd've been good to have a test; perhaps that would've stopped the
die handler being committed like that in the first place.

Smylers