[dancer-users] Dancer1 plugins and Dancer2 plugins

Alexis Sukrieh sukria at gmail.com
Mon Oct 7 14:36:16 BST 2013


Hi Slavik,


2013/9/16 Slavik Goltser <slavikg at gmail.com>

> I could not find any information on this, but what is the recommended way
> of migrating Dancer1 plugins to Dancer2? Is it to add version checking
> while keeping the Dacer1 naming or is it recommended to rename the plugins
> to Dancer2::Plugin... ?
>

First things first: don't bother with D1 compatibility, all Dancer2-related
distributions should be in the Dancer2 namespace, so no need for backward
compat and version checks.

What is suggested is to rename Dancer::Plugin::FooBar to
Dancer2::Plugin::FooBar.

That's for the naming.

Regarding the code, make sure your plugin uses the proper syntax: shifting
$dsl in each registered subs, like so:

  regsiter foo => sub {
    my $dsl = shift;
    ...
  };

Also make sure any import-time code are defined in "on_plugin_import"
blocks.

Good luck!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20131007/af3916d8/attachment.html>


More information about the dancer-users mailing list