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

Andrew Beverley andy at andybev.com
Tue Feb 17 12:56:27 GMT 2015


Hi guys,

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.

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 ;-)

As an example, I have successfully used the above to create a DBIC
provider for Plugins::Auth::Extensible, which uses a database connection
handle from Plugins::DBIC

Andy




More information about the dancer-users mailing list