[dancer-users] Dancer2::Plugin discussion (issue 184)
julio.fraire at gmail.com
Tue Mar 5 23:33:41 GMT 2013
In my quest to port an app to Dancer2, I stumbled with problems in
Dancer2::Plugin. The issues arise because plugins don't really have access
to the app (hooks, in particular) that is using them except when they are
I put together a Dancer2::Plugin substitute that basically declares hooks
and keywords while the plugin is being imported into a calling app, using
its dsl. It also creates a plugin object to hold its registered keywords,
hooks it provides and any hooks that the plugin needs to have run
externally (like during template rendering). Without singletons.
This Dancer2::Plugin does not pass all the tests. It fails when plugins try
to do "dancer things" outside of hooks and registered words, because there
is no dsl to support them. Some test suite plugin for which this thing
fails declares routes, for example, in the global scope.
However, with this construction and after slight modifications (changing
Dancer to Dancer2, eliminating plugin_args which is not needed after the
namespace split) I got an equivalent to Dancer::Plugin::FlashMessage and
This version of Dancer2::Plugin is at
Thank you for taking a look into the issue and this proposal.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dancer-users