Subject: | Can not use Test::Most in test modules with Moose |
For some tests I need at first the same code to run to a special point.
So I packed that test code into a Module and used Moose because I need
different attributes. So I write
package TestFoo;
use Moose;
use Test::Most;
...
And I get
Prototype mismatch: sub TestFoo::blessed ($) vs none
at /usr/lib64/perl5/vendor_perl/5.12.4/Test/Builder/Module.pm line 93
Test::Builder::Module::import(undef) called
at .../t/.../lib/TestFoo.pm line 3
TestFoo::BEGIN() called at .../t/.../lib/TestFoo.pm line 3
eval {...} called at .../t/.../lib/TestFoo.pm line 3
require TestFoo.pm called at .../t/.../01_foo.t line 3
main::BEGIN() called at .../t/.../lib/TestFoo.pm line 3
eval {...} called at .../t/.../lib/TestFoo.pm line 3
Here is the code of the test script:
use strict;
use warnings;
use Test::Most tests => 1;
use Test::NoWarnings;
use TestFoo;
ok 1;
The workaround is to remove Test::Most from Module and use Test::More
instead.