[dancer-users] Dancer::Plugin2

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


On Sun, 8 Feb 2015, D Perrett wrote:

> This is something that I have been struggling with as well. My
> experience is working on something (
> https://github.com/pdl/Articulate/ ) which I hope will become a very
> flexible base for CMSs of all sorts. I started off with it being a
> collection of Dancer1 plugins which worked together but the problem of
> "which app do I belong to" (which Dancer2, quite correctly, as far as

You are right.

> I'm concerned, forces you to think about) meant I had to consolidate
> it into a single mega-plugin which had subcomponents which explicitly
> know about each other - one of which is a framework adapter which
> works on either Dancer1 or Dancer2 (and possibly more).
>
> At the moment I'm quite happy about that and breathing easy because it
> was possible to reduce the interactions with Dancer to a couple of
> fairly contained components (even though the interface is still a bit
> ramshackle at present).
>
> That approach may be excessive for plugins to implement themselves,
> but having a generic 'DancerX::Plugin' class that does that stuff for
> you would be very nice.
>
> I also agree that it would be a massive help (possibly a prerequisite
> of the above) to have a single object for either Dancer which behaved
> the same way and which provides methods equivalent to the functional
> interface that you get when you do either `use Dancer;` or `use Dancer
> appname => 'Foo';`, and I would definitely be wiling to help out if it
> was something Dancer core devs agreed in principle should happen.
>
> Daniel
>
> Details of how I'm doing it so far if you're curious:
>
> https://github.com/pdl/Articulate/blob/master/lib/Dancer/Plugin/Articulate.pm
> https://github.com/pdl/Articulate/blob/master/lib/Dancer2/Plugin/Articulate.pm

With a 'DancerX::Plugin' that could be only one.

> https://github.com/pdl/Articulate/blob/master/lib/Articulate/FrameworkAdapter/Dancer1.pm
> https://github.com/pdl/Articulate/blob/master/lib/Articulate/FrameworkAdapter/Dancer2.pm

You implement a smal part of the DSL.
If you make your FrameworkAdapter/Dancer* a Dancer plugin, I think
you can do more.
Maybe even use "normal" plugins.
But your goal is to support other frameworks as well.
I'm interested.

++ for your Moo skils.

-- 
Henk


More information about the dancer-users mailing list