Gabor Szabo wrote: > It is obvious but would be nice if would not happen > > use Test::More; > diag explain $data; > > works nicely, then if I swicth to > > use Test::Most; > diag explain $data; > > it stops printing as it now requires TEST_VERBOSE > > > so Test::Most is not a drop-in replacement for Test::More.
How explain() works is something Ovid and I couldn't reconcile between Test::Most and Test::More. However, there is a way to make Test::Most backward compatible... sub explain { my $void_context = !defined wantarray; # Do nothing if we're called in void context and if TEST_VERBOSE is off return if !$ENV{TEST_VERBOSE} and !$void_context; my @diag = ...all that dumper stuff... diag(@diag) if $void_context; return @diag; } Which is to say, if it's used in void context do the display. Otherwise return the diagnostics. However, this leads to edge cases and I feel this was proposed for Test::More and I rejected it for just that reason. sub test_thing { ... explain(@stuff); # looks like void context, but it's not } -- On error resume stupid