PerlDancer / PerlDancer/Dancer2

Dancer2 Apps installed using CPAN can't be used in a site

Open
#674 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
604
Forks
288
Avg merge
1d 5h
Merged PRs (30d)
5

Description

Dancer2 Apps installed using CPAN can't be used in a site because they can't reach configuration files.

Scenario

You have an App on CPAN that you want to use in your site. You installed it using

 cpan -i MyAPP

and you have in your bin/app.pl

 use MyApp

MyApp uses plugins and you configured them in the config.yml under your siteroot.

When the plugin is invoked it starts looking for informations about configuration, but it calculates the config_location starting from the location of the MyApp module so it gets lost under your local perl repository, never reaching the config.yml under the siteroot.

Solutions (in my opinion)

A workaround is setting the DANCER_CONFDIR as siteroot. In my opinionis this is not a clean solution and at the moment I don't know how to use it when running the test-suite.

A solution could be to store the site root in the Dancer->Runner->Config as it the previous versions and use it as a default when calculated config_location has no config file inside it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with bin/app.pl and the config.yml under the siteroot, then trace how Dancer->Runner->Config determines config_location for a CPAN-installed MyApp. Compare that behavior with the DANCER_CONFDIR workaround and the proposed site-root fallback. Done means the installed app can reach the site's configuration, including when the test-suite is run.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.