perrettdl at googlemail.com
Sun Feb 8 19:22:26 GMT 2015
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
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.
Details of how I'm doing it so far if you're curious:
On 8 February 2015 at 14:24, David Precious <davidp at preshweb.co.uk> wrote:
> On Sun, 8 Feb 2015 10:21:52 +0100 (CET)
> Henk van Oers <hvo.pm at xs4all.nl> wrote:
>> What if there is a module Dancer::Plugin2 (or Dancer2::Plugin2)
>> that detects the Dancer version
>> and in the D1 case constructs a real $dsl object?
>> Can this help to write D1 plugins the D2 way?
>> And then make DRY plugins under this new namespace?
> This is something I've really wanted to find time to attempt - a
> universal plugin API module that plugins could inherit from, and write
> code using that API which would work the same in D1 & D2.
> Unfortunately, a tuit shortage has prevented me from it, so far; I
> think it'd need some fairly careful design to be useful, but if
> achieved, it'd be fantastic.
> Perhaps it's something we could collaborate on?
> dancer-users mailing list
> dancer-users at dancer.pm
More information about the dancer-users