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

Henk van Oers hvo.pm at xs4all.nl
Mon Feb 16 07:30:15 GMT 2015

On Sun, 15 Feb 2015, Andrew Beverley wrote:

> 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?

I also mist that until I started a plackup stand-alone app
and my screen was filled with warnings... :(

In Dancer2 you can not use your own keywords in plugins.

   my $rs = myresultset;

must be:

   my $rs = $dsl->app->myresultset;

and the plugin registering the keyword must be used
in a place where it is not realy used but gets in the dsl.

Your killing of the 'import' of Dancer2::Plugin is interesting.
I wonder, what if I make a normal exporter to get my resultset...

/me working on https://github.com/hvoers/Dancer-Plugin2

More information about the dancer-users mailing list