<div dir="ltr"><div>We clearly haven't thought about this case. I really wish we could clean up the plugin completely. It still isn't what we want it to be. :(<br><br></div>Could you please open an issue for this?<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 2, 2013 at 12:47 PM, Marco Pessotto <span dir="ltr"><<a href="mailto:melmothx@gmail.com" target="_blank">melmothx@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hello all!<br>
<br>
I have a question about the plugin nesting in Dancer2. I'd like to know<br>
if using a plugin (notably the Dancer2::Plugin::Database) inside another<br>
plugin is doable or deprecated or hacky or unsupported or just can't<br>
work.<br>
<br>
This used to work with Dancer1, but now it's unclear if and how it<br>
should work, as we don't do "use Dancer qw/:syntax/" anymore.<br>
<br>
The app at runtime seems to work, I get the expected output of the<br>
dumped D2::P::D object, but in a Dancer2 qw/:script/ it fails with a<br>
"deep recursion" error.<br>
<br>
use Dancer2 ":script";<br>
use Dancer2::Plugin::Test;<br>
print to_dumper(hello);<br>
<br>
perl -I lib t/script.t<br>
1..1<br>
DEPRECATED: Dancer2::Plugin::Test calls 'dsl' instead of '$dsl->dsl'. at /home/melmoth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/Dancer2/Plugin/Database.pm line 57.<br>
DEPRECATED: Dancer2::Plugin::Test calls 'dsl' instead of '$dsl->dsl'. at /tmp/MyApp/lib/Dancer2/Plugin/Test.pm line 6.<br>
DEPRECATED: Dancer2::Plugin::Test calls 'dsl' instead of '$dsl->dsl'. at /tmp/MyApp/lib/Dancer2/Plugin/Test.pm line 6.<br>
DEPRECATED: Dancer2::Plugin::Test calls 'dsl' instead of '$dsl->dsl'. at /tmp/MyApp/lib/Dancer2/Plugin/Test.pm line 6.<br>
DEPRECATED: Dancer2::Plugin::Test calls 'dsl' instead of '$dsl->dsl'. at /tmp/MyApp/lib/Dancer2/Plugin/Test.pm line 6.<br>
DEPRECATED: Dancer2::Plugin::Test calls 'dsl' instead of '$dsl->dsl'. at /tmp/MyApp/lib/Dancer2/Plugin/Test.pm line 6.<br>
Deep recursion on anonymous subroutine at /home/melmoth/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/Dancer2/Core/Role/DSL.pm line 72.<br>
# Looks like your test exited with 255 before it could output anything.<br>
<br>
The test app is the following (also packed in the tarball attached with<br>
the tests).<br>
<br>
conf:<br>
### cut ####<br>
plugins:<br>
Database:<br>
driver: SQLite<br>
database: 'foo.sqlite'<br>
### cut ####<br>
<br>
app:<br>
<br>
### cut ####<br>
<br>
package MyApp;<br>
use strict;<br>
use warnings;<br>
use Dancer2;<br>
use Dancer2::Plugin::Test;<br>
<br>
our $VERSION = '0.1';<br>
<br>
get '/' => sub {<br>
my $dbh = hello;<br>
return to_dumper($dbh);<br>
};<br>
<br>
true;<br>
<br>
### cut ####<br>
<br>
plugin:<br>
<br>
### cut ####<br>
package Dancer2::Plugin::Test;<br>
use strict;<br>
use warnings;<br>
<br>
use Dancer2::Plugin;<br>
use Dancer2::Plugin::Database;<br>
<br>
register hello => sub {<br>
my $dsl = shift;<br>
return database;<br>
};<br>
<br>
register_plugin;<br>
1;<br>
### cut ####<br>
<br>
Thanks in advance<br>
<br>
Best wishes<br>
<br>
<br>
<br><br>
<br>
<br>
--<br>
Marco<br>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>