On Wed, 18 Feb 2015, Andrew Beverley wrote:
On Wed, 2015-02-18 at 07:26 +0100, Henk van Oers wrote:
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.
Okay, I've probably muddied the waters here. I'm trying to think of this from the point of view of the end result. For me, that's reusing a database connection in different plugins.
A database connection should be reused, not only in a plugin.
I don't actually need to use one plugin inside another (although it might be useful for other scenarios).
Mmm. I do need this. (Or make exporters to make the keywords)
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/9383ade1e46691106e835cd9155976fa5247...
I'd like to ask for comments from the floor ;-)
This does not work for me. I do not want a global bdi.
The advantage of this is that you can reuse the same database connection handle.
There is no "the same database connection". I reuse all connections.
From what I can tell, reusing one plugin inside another would still open another database connection.
Not in D1.
Not a major issue, but it seems cleaner to use an existing one.
You can do that in D2 to. But it looks more verbose...
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.
Sorry if I've misunderstood, but do you mean that you want to share configuration options between different apps?
Yes. And not only between Dancer versions, but whatever framework. -- Henk