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:

Can't locate Dancer2/Plugin/Database.pm in @INC (you may need to insta +ll the Dancer2::Plugin::Database module)
bin/app.psgi looks like:
#!/usr/bin/env perl use strict; use warnings; use File::Basename; use File::Spec; use lib File::Spec->catdir( File::Basename::dirname( File::Spec->rel2a +bs($0) ), '..', 'local/lib/perl5' ); use lib File::Spec->catdir( File::Basename::dirname( File::Spec->rel2a +bs($0) ), '..', 'lib' ); use jwsDancer; jwsDancer->to_app;
lib/jwsDancer.pm
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;

For now I'm just trying to use the test that is generated by scaffolding a Dancer2 app via

prove -lv t/002_index_route.t

Can anyone give a hint what I should do to have the locally installed modules (in local/lib/perl5) work as well in the testing environment?


In reply to Testing a Dancer2 app with locally installed modules by GertMT

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.