<div dir="ltr">Hello,<div class="gmail_extra"><br><div class="gmail_quote">2013/1/3 Damien Krotkine <span dir="ltr"><<a href="mailto:dkrotkine@gmail.com" target="_blank">dkrotkine@gmail.com</a>></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'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'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's not the right solution, but at least you'll agree that there is an issue in the current state ( I think English speaking people say "red herring" :) </div><div> </div></blockquote>
<div><br></div><div style>You're absolutely right Damien, thanks to users like Celogeek who spend some time migrating a real application for 1 to 2, we'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 "package scoping by default" is a good idea but it's clear now that we need a way to disable that in some places.</div><div style><br></div><div style>I don'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't share hooks or engines. We need a way to tell Dancer to load multiple apps as one, I'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 'App::Foo', 'App::Bar';</div><div style><br></div><div style>That new "consume" 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 "apps".</div>
<div style><br></div><div style><br></div></div></div></div>