<div dir="ltr">Hello,<div class="gmail_extra"><br><div class="gmail_quote">2013/1/3 Damien Krotkine <span dir="ltr">&lt;<a href="mailto:dkrotkine@gmail.com" target="_blank">dkrotkine@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

    <div><br></div><div>We should accept that developers have the right to separate features by packages, and not oblige them to group routes and hooks per package. </div><div><br></div></blockquote><div><br></div><div style>
Indeed, and I&#39;d go even a step further:</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div><div>Celogeek mentioned that this can be worked around by using roles but not everybody ate fluent with them. </div>
<div><br></div><div>So, I propose that one could specify the scope of a hook. </div><div><br></div><div>By default a hook would be package-scoped. But we should make it possible to scope it to the whole application ( if that&#39;s possible), and also be able to scope it to a selection of routes, as David Golden mentioned. </div>
<div><br></div><div>Maybe it&#39;s not the right solution, but at least you&#39;ll agree that there is an issue in the current state ( I think English speaking people say &quot;red herring&quot; :)  </div><div> </div></blockquote>
<div><br></div><div style>You&#39;re absolutely right Damien, thanks to users like Celogeek who spend some time migrating a real application for 1 to 2, we&#39;ve realized that the scoping we have in 2 is great, but is not _always_ what the user wants.</div>
<div style><br></div><div style>I also think the &quot;package scoping by default&quot; is a good idea but it&#39;s clear now that we need a way to disable that in some places.</div><div style><br></div><div style>I don&#39;t think it should be an exception for hooks, or even a kind of hooks. I think the user should be able to say : these apps (packages) share the same registry, or in other words, these are supposed to be merged into one app.</div>
<div style><br></div><div style>For instance:</div><div style><br></div><div style>  package App;</div><div style>  use Dancer;</div><div style>  use App::Foo;</div><div style>  use App::Bar;</div><div style><br></div><div style>
In this example, everything in Foo and Bar are in a jail, they don&#39;t share hooks or engines. We need a way to tell Dancer to load multiple apps as one, I&#39;m not sure exactly how the DSL should be extended to allow that, but here is the idea I have in mind:</div>
<div style><br></div><div style>  package App;</div><div style>  use Dancer;</div><div style>  consume &#39;App::Foo&#39;, &#39;App::Bar&#39;;</div><div style><br></div><div style>That new &quot;consume&quot; keyword would be responsible for loading everything that is defined in the packages _into_ the current package. That would be, I think, the most generic and proper way to share settings, hooks and everything between &quot;apps&quot;.</div>
<div style><br></div><div style><br></div></div></div></div>