<div dir="ltr"><div><div><div><div><div><div>Hey Cymon, Mike.<br><br></div>The ":syntax" import tag wasn't ported to Dancer 2, other than accepting it. The tag was originally meant to not create a web server out of your application, which was useful for defining routes that aren't apps in and of themselves. In Dancer 2 the structure is a bit different which meant there was no need for the ":syntax" tag.<br>
<br></div>You can just "use Dancer2" in your scripts and read the configurations. This is totally fine.<br><br></div>We do, however, intend to support the ":script" tag (which is ignored for now) to prevent reading the @ARGV when processing requests. The problem is that the code for processing @ARGV hasn't been ported, so everything is working as if ":script" is in effect.<br>
<br>In the end, the situation we want is:<br></div>* "use Dancer2" without worrying.<br></div>* "use Dancer2 ':script'" when you want to prevent @ARGV parsing, so you could have your own in your script.<br>
<br></div>The first one is there. The second one is implied since there's no @ARGV parsing, but we will add it in the future. Perhaps you will do it? :)<br><div><div><div><div><div><br></div><div>I hope that answers your questions.<br>
<br></div></div></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Sep 7, 2013 at 1:20 AM, Mike South <span dir="ltr"><<a href="mailto:msouth@gmail.com" target="_blank">msouth@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>dancer newbie here. I recently wrote a script that read the dancer config in manually. In my opinion, this would be a great import tag.</div>
<div><br></div><div>I'll share my use case (while bracing for "that doesn't belong in config, you idiot!" responses--it's ok, just tell me if you think that, I'm eager to learn.):</div>
<div><br></div><div>I have a development, staging, and production instance of the app that run on the same url but different ports. I want to put the port number in the config.yml. Another thing someone might want in there would be the location of the PID file for killing the currently running process. I need this in the script that I use to start/re-start the app, which takes the name of the environment as an argument, then checks the PID file for the ID of a running process, kills and reports that, then runs plackup, telling it the port to start on and the name of the run file.</div>
<div><br></div><div>Another thing you might want available outside the app is a mount point--instead of differentiating by port, you could mount the app at a different virtual directory (or whatever you call the url prefix). Possibly hostname, too--in short, anything I need to pass to plackup, I would like to be available in a script that doesn't start the app, but gives me the configuration info I need to start the app.</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div><div>mike</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 6, 2013 at 3:30 PM, Cymon <span dir="ltr"><<a href="mailto:cymon.ML@gmail.com" target="_blank">cymon.ML@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I was a little puzzled when I saw the "Use Dancer :syntax" disappear in<br>
the 0.007 release.<br>
I thought that a less powerful Dancer inclusion was needed as the "Use<br>
Dancer" create an App in every package is used.<br>
Thinking about it I realized that probably it's a matter of "code<br>
discipline" (tell me if I'm wrong). The right way to do things is not<br>
importing "a part" of Dancer environment, but passing the $dsl object<br>
when needed, so I accepted that.<br>
<br>
Even so, I think that there's a case when a "light" dancer import is<br>
needed and it is when you need to use some configuration you have in<br>
the config.yml that should be the master configuration file for<br>
everything in your project (in my idea).<br>
<br>
So I was wondering if it could be useful to add a "Use Dancer :config"<br>
way to import Dancer just to make the config keyword accessible,<br>
without creating an App.<br>
<br>
What do you think about this?<br>
<span><font color="#888888"><br>
<br>
<br>
--<br>
Simone "Cymon" Faré<br>
<a href="http://perlishscrewdriver.blogspot.com" target="_blank">http://perlishscrewdriver.blogspot.com</a><br>
_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</font></span></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>