Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appdir setting confusion #1399

Open
bolangi opened this issue Nov 18, 2017 · 1 comment
Open

appdir setting confusion #1399

bolangi opened this issue Nov 18, 2017 · 1 comment

Comments

@bolangi
Copy link

bolangi commented Nov 18, 2017

Dear Maintainers,

In the app template created by the dancer2 utility, the sample app code is placed in appdir/lib. This is more than a possibility for organizing code, it is required for the webapp to start correctly, because Dancer2/Core/Role/HasLocation.pm uses this directory structure to set config->{appdir}, the root directory of the webapp.

Dancer2::Manual states:

  When Dancer2 is imported to a script, that script becomes a webapp

I think this needs to be more clear. In the perl culture, a module's install location is not usually relevant to how a module operates, except for the priority of the module being found when the interpreter scans @inc looking for a module to load.

In Dancer1, the webapp module doesn't need to be in appdir/lib/, at least it worked for me to install my webapp in a standard (for perl) location. So this difference in behavior between D1 and D2 could be a cause for extra hiccups during migration, as exemplified by my experience.

If we conclude that there is a problem (and the code comments suggest some pain here) one part of the solution could be to state clearly that the webapp module that imports Dancer2 must be located under appdir/lib.

A second part could be to introduce a routine that issues a warning message about a possibly wrong appdir setting if the appdir doesn't contain a config.yml file or bin/ or environments/ directories.

A third part of the solution could be to add a DANCER2_APPDIR environment variable, and document that it is available.

Thank you for your attention.

Joel Roth

@kal247
Copy link

kal247 commented Feb 24, 2018

I've had the same kind of trouble, and I couldn't make set appdir work. I support your 3rd suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants