Le vendredi 4 janvier 2013 à 13:57, David Precious a écrit :
On Fri, 4 Jan 2013 10:28:43 +0100Alexis Sukrieh <sukria@sukria.net> wrote:I think the user should be able to say : these apps (packages) sharethe same registry, or in other words, these are supposed to be mergedinto one app.For instance:package App;use Dancer;use App::Foo;use App::Bar;In this example, everything in Foo and Bar are in a jail, they don'tshare hooks or engines. We need a way to tell Dancer to load multipleapps as one, I'm not sure exactly how the DSL should be extended toallow that, but here is the idea I have in mind:package App;use Dancer;consume 'App::Foo', 'App::Bar';That new "consume" keyword would be responsible for loadingeverything that is defined in the packages _into_ the currentpackage. That would be, I think, the most generic and proper way toshare settings, hooks and everything between "apps".Hmm, I like that; the sounds like it could be a good solution to theproblem.I definitely think it should be possible to load routes etc fromdifferent packages but have them share a scope for config / hooks etc.At $work, we have a very large Dancer app, with routes defined invarious packages (grouped logically); however, we have before hookswhich should run for all routes, and session engine / serializer etcsettings which apply to all; we'd need to be able to do the same with D2one way or another.Part of me wonders if the auto scope-per-package stuff should beconfigurable, so you could request D1-style "all in one" behaviour ifdesired, but I'm not sure.--David Precious ("bigpresh") <davidp@preshweb.co.uk>http://www.preshweb.co.uk/ www.preshweb.co.uk/twitterwww.preshweb.co.uk/linkedin www.preshweb.co.uk/facebookwww.preshweb.co.uk/cpan www.preshweb.co.uk/github_______________________________________________dancer-users mailing listdancer-users@dancer.pmhttp://lists.preshweb.co.uk/mailman/listinfo/dancer-users