[dancer-users] plugin_setting function
Kadir Beyazlı
kadirbeyazli at gmail.com
Mon Jun 29 23:54:44 BST 2015
Hi,
I understood logic of plugin_setting() function.
It is used to define some configurations to plugin.
But I am still getting empty output from function plugin_setting()
althouh I set it at config.yml
By the way my plugin code is at following folder (mywebapp is root folder)
mywebapp/lib/Dancer2/Plugin/MyTest.pm
test.pl is at following folder
mywebapp/bin/test.pl
On Tue, Jun 30, 2015 at 12:58 AM, Kadir Beyazlı <kadirbeyazli at gmail.com> wrote:
> Hi All,
>
> I am studying plugins so I am reading manual from cpan (thanks to
> sawyer) and testing all codes at my pc.
> I did not get any result by calling function plugin_setting()
>
> my code to test calling plugin (test.pl) and plugin code (MyTest.pm)
> is written below:
>
> --------------------------------------------------------------------------------------------------
> #test.pl
> use Dancer2;
>
> use lib "../lib/";
> use Dancer2::Plugin::MyTest;
>
> get '/mytest' => sub { mytest('I am Testing') };
>
> dance();
> ----------------------------------------------------------------------------------------------------
> #MyTest.pm
> package Dancer2::Plugin::MyTest;
> use Dancer2::Plugin;
>
> register mytest => sub {
> my ($dsl, @args) = plugin_args(@_);
> my $conf = plugin_setting();
>
> use Data::Dumper;
> return Dumper($conf);
> };
>
> register_plugin for_versions => [ 2 ] ;
>
> 1;
> -----------------------------------------------------------------------------------------------------------------------------------
>
> I added following code to config.yml
>
> -----------------------------------------------------------------------------------------------------------------------------------
> #config.yml
> plugins:
> "Dancer2::Plugin::MyTest":
> key: value
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Output of my code which is also output of function plugin_setting() is
> empty as follow:
>
> $VAR1 = {};
>
> I changed config.yml as follow but output is empty again
>
> -----------------------------------------------------------------------------------------------------------------------------------
> #config.yml
> plugins:
> "MyTest:
> key: value
> -----------------------------------------------------------------------------------------------------------------------------------
>
> How should I customize config.yml file to be able to see output and
> what is aim of function plugin_setting()?
>
>
> Kadir Beyazlı
> GSM : +90 535 821 50 00
--
Kadir Beyazlı
Computer Engineer
GSM : +90 535 821 50 00
More information about the dancer-users
mailing list