<div id="reply-content">
Sorry, top posting...
</div><div id="reply-content"><br></div><div id="reply-content">An other way is to think about it bottom up instead of top down</div><div id="reply-content"><br></div><div id="reply-content">Instead of the parent app including the children packages, we could do :</div><div id="reply-content"><br></div><div id="reply-content">package App::Foo;</div><div id="reply-content">use Dancer scope => qw(App);</div><div id="reply-content"><br></div><div id="reply-content">It's a bit like in relational database where you say who your parent is, not who your children are. </div><div id="reply-content"><br></div><div id="reply-content">It Also avoids to change the parent package every time you add a child. </div><div id="reply-content"><br></div><div id="reply-content">Also it makes it possible to use dancer with more than one scope. Not why it would useful though :)</div><div id="reply-content"><br></div><div id="reply-content">We should probably look at breadboard and catalyst, see how they do it. David, I think you have experience with catalyst?</div><div id="reply-content"><br></div><div id="reply-content">And that brings up the fact that we should use a serious tool to handle dancer 'use' options. Can we try an enhanced sub::exporter or similar?</div>
<div id="D459D4E675D147FC900FA0243D9E5806"></div>
<p style="color: #A0A0A8;">Le vendredi 4 janvier 2013 à 13:57, David Precious a écrit :</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<div id="quoted-message-content"><div><div>On Fri, 4 Jan 2013 10:28:43 +0100</div><div>Alexis Sukrieh <sukria@sukria.net> wrote:</div><blockquote type="cite"><div><div>I think the user should be able to say : these apps (packages) share</div><div>the same registry, or in other words, these are supposed to be merged</div><div>into one app.</div><div><br></div><div>For instance:</div><div><br></div><div> package App;</div><div> use Dancer;</div><div> use App::Foo;</div><div> use App::Bar;</div><div><br></div><div>In this example, everything in Foo and Bar are in a jail, they don't</div><div>share hooks or engines. We need a way to tell Dancer to load multiple</div><div>apps as one, I'm not sure exactly how the DSL should be extended to</div><div>allow that, but here is the idea I have in mind:</div><div><br></div><div> package App;</div><div> use Dancer;</div><div> consume 'App::Foo', 'App::Bar';</div><div><br></div><div>That new "consume" keyword would be responsible for loading</div><div>everything that is defined in the packages _into_ the current</div><div>package. That would be, I think, the most generic and proper way to</div><div>share settings, hooks and everything between "apps".</div></div></blockquote><div><br></div><div>Hmm, I like that; the sounds like it could be a good solution to the</div><div>problem.</div><div><br></div><div>I definitely think it should be possible to load routes etc from</div><div>different packages but have them share a scope for config / hooks etc.</div><div><br></div><div>At $work, we have a very large Dancer app, with routes defined in</div><div>various packages (grouped logically); however, we have before hooks</div><div>which should run for all routes, and session engine / serializer etc</div><div>settings which apply to all; we'd need to be able to do the same with D2</div><div>one way or another.</div><div><br></div><div>Part of me wonders if the auto scope-per-package stuff should be</div><div>configurable, so you could request D1-style "all in one" behaviour if</div><div>desired, but I'm not sure.</div><div><br></div><div><br></div><div>-- </div><div>David Precious ("bigpresh") <davidp@preshweb.co.uk></div><div>http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter</div><div>www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook</div><div>www.preshweb.co.uk/cpan www.preshweb.co.uk/github</div><div><br></div><div><br></div><div>_______________________________________________</div><div>dancer-users mailing list</div><div>dancer-users@dancer.pm</div><div>http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</div></div></div>
</blockquote>
<div>
<br>
</div>