[dancer-users] [SOLVED] Calling plugin_setting from a plugedin keyword

Henk van Oers henk at signature.nl
Wed Mar 11 07:28:19 GMT 2015


On Sun, 8 Mar 2015, Henk van Oers wrote:

[...]

> So, the question is:
> How do I call 'plugin_setting' in a D2 plugin?

Found it! Call plugin_setting in an on_plugin_import block.

my $settings = {};

on_plugin_import {
     $settings  = plugin_setting()
         unless $settings->{'_loaded'};
     $settings->{'_loaded'} = 1;
};

register mykeyword => sub { ... $settings->{'thing'} ... };
...

Now you can call $dsl->mykeyword
without the "... calls 'dsl' instead of '$dsl->dsl' ..." warning.

-- 
Henk van Oers


More information about the dancer-users mailing list