18 Feb
2015
18 Feb
'15
9:09 a.m.
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? Andy