I’m writing some tests in Perl which have a fair amount of set up. This setup all lives in a module that the test scripts use. I want to be able to print some diagnostics from the module, and intended to use the diag function from Test::More. Problem is, when you use Test::More, it writes the plan so I get
You tried to plan twice at lib/MyTest.pm line 15.
Is there any way I can use diag (or is there an equivalent), or am I stuck with print STDERR?
For me, the following code:
Just prints
Test::Morewon’t print the plan unless you tell it to. This is done by passing args to its import:Or by calling plan explicitly.