I have managed to reproduce the problem (Perl 5.26.2, fedora linux) when I omitted ./ from INC dir - as Test::Classifier requires t::TestMods::Test::Processor :
prove -Iblib/lib -It/TestMods t/01-file-collector.t
t/01-file-collector.t .. # Running my tests
t/01-file-collector.t .. 1/13
# Failed test 'creates an object'
# at t/01-file-collector.t line 30.
# died: Test::Classifier is not a Role::Tiny at /home/andreas/Download
+s/File-Collector-0.037/blib/lib/File/Collector.pm line 391.
# Failed test 'has files property'
# at t/01-file-collector.t line 34.
# Failed test 'has common_dir property'
# at t/01-file-collector.t line 38.
Can't call method "get_count" on unblessed reference at t/01-file-coll
+ector.t line 41.
# Looks like your test exited with 2 just after 4.
This works fine on my system:
prove -Iblib/lib -It/TestMods -I. t/01-file-collector.t
Could it be that some of the modules in t/TestMods do not load correctly under certain circumstances?
A comment on your code if I may (File-Collector-0.037 / lib / File / Collector.pm):
# eval class code
foreach my $class ( @$classes ) {
eval "require $class";
}
Adding a check on eval will tell you if requireed class was not found or failed to load. e.g. from eval, e.g. eval "xyz"; die $@ if $@;
I make this comment because the test fails when constructor sets @classes to contain Test::Classifier. Does this module load OK?
Same goes for AUTOLOAD in said file:
my $obj = $class->new($s->{_files}{all},
\($s->{selected}),
$s->{_files}{"${cat}_files"}{_files});
return $obj;
You may want to check whether $obj materialised before returning instead of relying on caller checking if got undef.
bw, bliako |