[dancer-users] plugin_setting function
Kadir Beyazlı
kadirbeyazli at gmail.com
Mon Jun 29 22:58:59 BST 2015
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
More information about the dancer-users
mailing list