I have a test program which, after a few sanity checks, tests to see if an external resource is available. If it's not, I need to skip the rest of the tests, but I want to use a plan and I don't want to keep counting the number of tests after the skip. Thus, I've done the following, but I'm wondering if there is a better way.
unless ($connection) { my $builder = Test::Builder->new; my $plan = $builder->has_plan; my $remaining_tests = looks_like_number($plan) ? $plan - $builder->current_test : 1; # always show at least one test skipped SKIP: { skip $connection->error, $remaining_tests } exit; } Cheers, Ovid -- Buy the book -- http://www.oreilly.com/catalog/perlhks/ Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/