[dancer-users] Dancer2::Session::DBIC

Andrew Beverley andy at andybev.com
Sun Feb 15 21:54:33 GMT 2015


Sorry, just picking up on this now:

On Wed, 2015-01-07 at 08:27 +0100, Stefan Hornburg (Racke) wrote:
> > Curious too: why doesn't this module use Dancer2::Plugin::DBIC ?  I'm already using DBIC elsewhere in my application and it seems silly / redundant to me to have to define the connect string in two different places in the config.  Seems to me it'd be far simpler to just have the config nominate which DBIC 'schema' connection to use and simply fall back to 'default' if none is provided.
> > 
> >  (as an aside, I'm also working on a DBIC provider for D2::Plugin::Auth::Extensible for the same reason - to reuse the existing DBIC config, but retaining the user-definable table structures as per the Database provider).
> > 
> 
> I don't think that this is even possible in Dancer 1, to use plugin in
> an engine. In Dancer 2, you can't use a plugin in another plugin as the
> plugin architecture is broken in this regard.

I've reused the DBIC plugin inside another plugin. Is this something
that I shouldn't be doing? I've done this:

package Dancer2::Plugin::MyPlugin;
use Dancer2::Plugin;
use Dancer2::Plugin::DBIC qw//;
my $schema = Dancer2::Plugin::DBIC::schema;

And everything works okay. Am I missing something?

Andy




More information about the dancer-users mailing list