Hi all,

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

Would an EXIT() function in Test::Most be warranted?

  sub EXIT ($) {
      my $message  = shift;
      my $test_num = Test::Builder->new->current_test;
      diag $message;
      exit $test_num;
  }

  # Later
  ok $foo or EXIT "Some message"; # halts with proper exit code

Since it's far less likely that someone has overridden exit(), this
function makes it more likely that your test suite would not only stop
when it should, but exit with the correct error code.

I do, however, feel like I'm missing something fundamental, but I can't
figure out what.

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to