[dancer-users] Plugin globals, and sharing database connections between plugins

Henk van Oers hvo.pm at xs4all.nl
Wed Feb 18 06:26:47 GMT 2015


On Tue, 17 Feb 2015, Andrew Beverley wrote:
>
> There has been discussion over the last few weeks about the plugin
> architecture having problems, in terms of using one plugin's functions
> inside another's.

It works in D1, not in D2.

> One area that this is particularly problematic is using a database
> plugin in another plugin, for example in an authentication module.
>
> For the latter scenario (but probably not the former), I thought it
> might be useful if a plugin could register global data, that could be
> accessed by other plugins. This patch does exactly that:
>
> https://github.com/ctrlo/Dancer2/commit/9383ade1e46691106e835cd9155976fa5247b541
>
> I'd like to ask for comments from the floor ;-)

This does not work for me. I do not want a global bdi.
I compose sites using partial apps using unrelated shemas.
Yes, I have a DPAE provider using DBIC.
But other partial-apps do not know this, use there own shema.

"global data" sounds like config.yml
I would like a Dancer::Unified::Config
used by D1 and D2, to keep it DRY.

-- 
Henk

TODO:
Dancer::Plugin should export "on_plugin_import".
Dancer2::Plugin should export "add_hook".


More information about the dancer-users mailing list