On Wed, Feb 18, 2015 at 2:35 AM, Andrew Beverley <andy@andybev.com> 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. I don't actually need to use one plugin inside another (although it might be useful for other scenarios).
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. 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. -Naveed
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?
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users