On Fri, 4 Jan 2013 10:28:43 +0100 Alexis Sukrieh <sukria@sukria.net> wrote:
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.
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'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:
package App; use Dancer; consume 'App::Foo', 'App::Bar';
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".
Hmm, I like that; the sounds like it could be a good solution to the problem. I definitely think it should be possible to load routes etc from different packages but have them share a scope for config / hooks etc. At $work, we have a very large Dancer app, with routes defined in various packages (grouped logically); however, we have before hooks which should run for all routes, and session engine / serializer etc settings which apply to all; we'd need to be able to do the same with D2 one way or another. Part of me wonders if the auto scope-per-package stuff should be configurable, so you could request D1-style "all in one" behaviour if desired, but I'm not sure. -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github