On Thu, Dec 27, 2012 at 5:37 PM, Rolf Schaufelberger &lt;<a href="mailto:rs@plusw.de">rs@plusw.de</a>&gt; wrote:<br>&gt; Hi,<br>&gt; as I wrote in my previous mail I&#39;m just testing Dancer if it can replace my current framework.<br>

&gt;<br>&gt; Currently I&#39;m using DBIC (and like to keep it) and I store some parameters and all my i18n stuff in a database.<br>&gt; So at server startup I need at first my DBIC connection settings  to be able to pull my other settings and my localization stuff from database.<br>

&gt; While I&#39;m  not shure yet, whether I can use some of the existing plugins for I18N,<br>&gt; the general question for me is, how can I configure the order, how plugins are loaded and initialized ?<br>&gt;<br>&gt; Regards<br>

&gt; Rolf Schaufelberger<br><br>There are generally 2 ways to configure Dancer apps. You can do static<br>configuration via config files such as config.yml. You can do dynamic<br>configuration at run-time via the `set` and `config` keywords. The following is one approach<br>

you can take:<br><br><font face="courier new, monospace" size="1">    </font><span style="font-family:&#39;courier new&#39;,monospace;font-size:x-small">use Dancer;</span><div><font face="courier new, monospace" size="1">    use Dancer::Plugin::DBIC qw(schema);<br>

<br>    # Set configuration at run time. This code only runs once at app start-up.<br>    my $dbconfig = schema-&gt;resultset(&#39;Config&#39;)-&gt;search({ env =&gt; &#39;production&#39; });<br>    # This will set top-level config settings.<br>

    set $dbconfig-&gt;get_columns();<br>    # You can use `config` to set nested values, such as for plugins.<br>    config-&gt;{plugins}{I18N}{language} = $dbconfig-&gt;language;<br><br>    # Now define your routes, etc.<br>

    get &#39;/&#39; =&gt; sub { ... };<br><br>    dance;</font><br><br>In the above example, the DBIC plugin is configured first, behind the scenes, via a config file such as config.yml (not shown).  Since your other plugin depends on it, you can configure it inside the app, at the file lexical scope.  This will only get run once, when your app is loaded (unless you are running your app via CGI). And this provides some control over the order that your plugins are &quot;configured&quot;. I don&#39;t know how to control the order that plugins are &quot;loaded&quot;. But I know for the plugins I have written, it is fine to load them in any order, and configure them dynamically at run-time.<br>

<br>I don&#39;t claim this is the best approach. Just the first thing that came to my mind.<br><br>Regards,<br>Naveed Massjouni</div>