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?
-
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.