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

Andrew Beverley andy at andybev.com
Wed Feb 18 09:09:14 GMT 2015

On Wed, 2015-02-18 at 03:18 -0500, Naveed Massjouni wrote:
> > The advantage of this is that you can reuse the same database connection
> > handle. From what I can tell, reusing one plugin inside another would
> > still open another database connection. Not a major issue, but it seems
> > cleaner to use an existing one.
> In the case of the DBIC plugin, its schema keyword is essentially
> memoized (schema objects are cached in memory), so it would not open
> another database connection. Unless of course if schema() was called
> with a different argument.

It's only memoized within each instantiation of the object. So if you
"use Dancer2::Plugin::DBIC" within another plugin, you get a second
connection. Correct?


More information about the dancer-users mailing list