perlquestion
GertMT
<p>Just decided to get more into testing (i've read it is almost guaranteed my code will improve..). I created a new Dancer2 app. The modules I use are installed locally via a cpanfile and a `carton install` command. Everything works though I cannot get the testing to work as I get warnings like:</p>
<code>
Can't locate Dancer2/Plugin/Database.pm in @INC (you may need to install the Dancer2::Plugin::Database module)
</code>
<h5>bin/app.psgi</strong> looks like:</h5>
<code>
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use File::Spec;
use lib File::Spec->catdir( File::Basename::dirname( File::Spec->rel2abs($0) ),
'..', 'local/lib/perl5' );
use lib File::Spec->catdir( File::Basename::dirname( File::Spec->rel2abs($0) ),
'..', 'lib' );
use jwsDancer;
jwsDancer->to_app;
</code>
<h5>lib/jwsDancer.pm</h5>
<code>
package jwsDancer;
use Dancer2;
use Dancer2::Plugin::Database;
use Dancer2::FileUtils qw/path read_file_content/;
use Cwd qw(abs_path);
use lib dirname( dirname abs_path $0) . '/../../lib';
get '/' => sub {
template 'index' => { 'title' => 'a web page' };
true;
</code>
<p>
For now I'm just trying to use the test that is generated by scaffolding a Dancer2 app via</p>
<code>prove -lv t/002_index_route.t</code>
<br>
<p>
Can anyone give a hint what I should do to have the locally installed modules (in <code>local/lib/perl5</code>) work as well in the testing environment?
</p>