Here's a version that actually works. Feel free to take this module and run with it.
Trying to use this module uncovered a bug in Test::More::plan() where this: plan tests => 1; is the equivalent of plan tests => 1; Test::More->import; Thus you pretty much must do: use Test::More tests => 1; use Test::ok; package Test::ok; use Test::Builder; my $TB = Test::Builder->new; sub import { my $caller = caller; no warnings 'redefine'; *{$caller.'::ok'} = \&ok; } sub ok { my @args = @_; # Run all sub references. for (0..1) { $args[$_] = $args[$_]->() if ref $args[$_] eq 'CODE'; } my $result; my($got, $expected, $diag) = @args; if( @args == 1 ) { $result = $TB->ok($got); } if( ref $expected eq 'Regexp' or $TB->maybe_regex($expected) ) { $result = $TB->like($got, $expected); } else { $result = $TB->is_eq($got, $expected); } $TB->diag($diag) if !$result and @_ == 3; } 1; -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern/ 3. With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. -- RFC 1925