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

D Perrett perrettdl at googlemail.com
Wed Feb 18 08:32:00 GMT 2015

My gut feeling is that as an application developer I could make some
use of it but as a plugin developer I would much prefer to use
function/method calls and I would much prefer to expose only function
calls and not guarantee the nature of any global variables.

One reason is order of execution. What happens if the global is not
(and cannot be) set until a given keyword is called the first time?


On 17 February 2015 at 12:56, Andrew Beverley <andy at andybev.com> wrote:
> 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
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

More information about the dancer-users mailing list