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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.