<p dir="ltr">Though doing it this way requires the user to maintain a manifest or some sort of class loading system, does it not? </p>
<p dir="ltr">Cheers,<br>
Rik</p>
<div class="gmail_quote">On 4 Jan 2013 13:21, "Damien Krotkine" <<a href="mailto:dkrotkine@gmail.com">dkrotkine@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
Sorry, top posting...
</div><div><br></div><div>An other way is to think about it bottom up instead of top down</div><div><br></div><div>Instead of the parent app including the children packages, we could do :</div><div><br></div><div>package App::Foo;</div>
<div>use Dancer scope => qw(App);</div><div><br></div><div>It's a bit like in relational database where you say who your parent is, not who your children are. </div><div><br></div><div>It Also avoids to change the parent package every time you add a child. </div>
<div><br></div><div>Also it makes it possible to use dancer with more than one scope. Not why it would useful though :)</div><div><br></div><div>We should probably look at breadboard and catalyst, see how they do it. David, I think you have experience with catalyst?</div>
<div><br></div><div>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></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><div><div>On Fri, 4 Jan 2013 10:28:43 +0100</div><div>Alexis Sukrieh <<a href="mailto:sukria@sukria.net" target="_blank">sukria@sukria.net</a>> 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") <<a href="mailto:davidp@preshweb.co.uk" target="_blank">davidp@preshweb.co.uk</a>></div>
<div><a href="http://www.preshweb.co.uk/" target="_blank">http://www.preshweb.co.uk/</a> <a href="http://www.preshweb.co.uk/twitter" target="_blank">www.preshweb.co.uk/twitter</a></div><div><a href="http://www.preshweb.co.uk/linkedin" target="_blank">www.preshweb.co.uk/linkedin</a> <a href="http://www.preshweb.co.uk/facebook" target="_blank">www.preshweb.co.uk/facebook</a></div>
<div><a href="http://www.preshweb.co.uk/cpan" target="_blank">www.preshweb.co.uk/cpan</a> <a href="http://www.preshweb.co.uk/github" target="_blank">www.preshweb.co.uk/github</a></div><div><br></div><div><br></div>
<div>_______________________________________________</div><div>dancer-users mailing list</div><div><a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a></div><div><a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a></div>
</div></div>
</blockquote>
<div>
<br>
</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>