But I managed to do it! With a little help from a helpful fellow on IRC
channel #dancer, I found a way to solve my problem, without changing any
of the code of Dancer2, and without requiring the calling of any new DSL
keyword inside every App. And here's how:
My plugin's code, which solves the problem, goes something like this:
package MyPlugin;
use strict;
use warnings;
use Dancer2::Plugin;
sub import {
my $dsl = &Dancer2::Plugin::_get_dsl();
$dsl->app->add_hook(
Dancer2::Core::Hook->new(name => 'before', code => sub {
[...]
})
);
};
register_plugin for_versions => [2];
And that, solves the problem!
On 03/04/2013 07:56 PM, David Golden wrote:
Not yet. See github issues #184 and #190.
On Mon, Mar 4, 2013 at 8:14 AM, Punter <[email protected]> wrote:
I've made a plugin, which installs a hook, with: hook 'before' => sub {...}
Unfortunately, when I use this plugin from more than one Apps, the hook gets
installed only on the first App that uses my module.
Question: Is it possible to install the hook to every App that uses the
module?
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users