William McKee wrote:
Hi all,

I am looking for a graceful way to exit a test should one of my subtests
fail. I don't think that I want to skip the test; I'd prefer to report an
error and discontinue processing so that I don't try to add/delete bogus
data into my database. However, I'm open to persusasion <g>.

I checked the docs at perl.apache.org but didn't find any helper
routines or examples that fit my needs. The only thing I can image doing
is adding a die statement after my test:

 die "Unable to read \$userdata." unless defined $userdata && ref $userdata eq 
'HASH';

Any other thoughts?

This is on the Test::Harness territory, not A-T's one. Looking at the T-H manpage we find:


      Bail out!
           As an emergency measure, a test script can decide that further
           tests are useless (e.g. missing dependencies) and testing should
           stop immediately. In that case the test script prints the magic
           words

             Bail out!

           to standard output. Any message after these words will be displayed
           by "Test::Harness" as the reason why testing is stopped.

I haven't tested whether this really works in A-T, but I see no reason why it shouldn't.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to