PerlDancer/Dancer2 — pull request #459 by veryrusty (2013-09-15 00:32:37+00:00)
Title: Pr/import settings - apply setting when Dancer2 or your app is imported.

Adds functionality to allow configuration options passed on use line as per #355.

Allows settings for the Runner and Server to be defined in a script without adding config triggers for them. This includes `port` (see #385) and `apphandler` (see #447 - this setting is important as it needs determined before the Runner builds the Server object, which happens on import).

Second part of this Pr is to make the host, port and is_daemon attributes in Role::Server read-only. The tests that used Test::TCP needed reworking as they were changing the server port (they new find an empty port in a begin block and use that in the import of Dancer 2).

@ambs suggested I Pr this before it grows any bigger (thanks for the poke!) Here are points I wanted to consider but haven't had the chance to yet:
* Documentation - applying settings via import is not documented.
* I'm not convinced with the order that settings are overridden it correct. Its currently
* ENV vars (and Runner defaults)
* settings from import (ie. use Dancer2 port => 4321 )
* settings from config files.

The first two may need to be in the other order.