On Sun, 18 Mar 2001, Michael G Schwern wrote: > > skip { > my $pig = Pigs->new; > $pig->takeoff; > ok( $pig->altitude > 0 ); > ok( $pig->mach >= 2 ); > } Pigs->can('fly'); > > That is, "don't run this block of tests unless Pigs can fly." I still > need to know how many tests were inside the block without running them > (so I can report the proper number of "ok 3 # skip"s). Oh, okay. In that case, I'd avoid the problem by making the number of tests to skip an explicit parameter. In fact, ordinary Perl syntax would do: if ( Pigs->can('fly') ) { my $pig = Pigs->new; $pig->takeoff; ok( $pig->altitude > 0 ); ok( $pig->mach >= 2 ); } else { skip( 2, "Pigs can't fly" ); } It does have the problem that someone could still screw up and give the wrong number of tests to skip. One way around that would be to separate the tests from the preparation: skip { my $pig; prepare { $pig = Pigs->new; $pig->takeoff; }; ok { $pig->altitude > 0 }; ok { $pig->mach >= 2 }; } Pigs->can('fly'); ..or perhaps simply: skip { my $pig = Pigs->new unless $SKIP; $pig->takeoff unless $SKIP; ok { $pig->altitude > 0 }; ok { $pig->mach >= 2 }; } !Pigs->can('fly'); -- Ilmari Karonen http://www.sci.fi/~iltzu/ ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe