The whole point of PSGI is to get as far away from A-patch-y as possible. You might have a better time with starman behind a reverse proxy like haproxy, nginx, or varnishd. Principally, the "dance app" is just what's in bin/app.psgi or whatever you named it. Furthermore, there's nothing dependant about what's in ../lib than what you have yourself coded. E.g., app.psgi doesn't have to have any external dependencies other that the code Dancer module.

If you look in bin/app.psgi generated by your referenced document, you will note:

#!/usr/bin/perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; # use this block if you don't need middleware, and only have a single +target Dancer app to run here use Dancr2; Dancr2->to_app;
So the line, use lib "$FindBin::Bin/../lib"; is the answer to your question. So you would want to replace that to ensure that the right path is in @INC. But if you can help it, get off the Apache plantation pronto. If it's getting invoked by Apache "as is", who the heck knows what the is going to translate into.

And I imagine Dancer2 does care that views, public, etc are next to whatever lib you use to to_app. The initial use lib ... line just gets to the module that has the use Dancer2; line and defines the handlers. So YMMV.


In reply to Re: Dancer2: Why is bundled 'lib/' required? by perlfan
in thread Dancer2: Why is bundled 'lib/' required? by kcott

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.