Here's the few lines from a hypothetical MainApp in /lib: # File 1 package MainApp; use ExtendingApp; use HTML::Element;
And here is a perl module that extends this app. # File 2 package ExtendingApp; use Dancer2 appname => MainApp; get '/' => sub { my $element = HTML::Element->new('h1'); }; ### END ### This works. I get no errors because the HTML::Element module can be seen inside routes. However, unless I'm missing something, this doesn't work. # File 1 package MainApp; use ExtendingApp; use Dancer2::Plugin::Database; # File 2 package ExtendingApp; use Dancer2 appname => MainApp; get '/' => sub { my @data = database->quick_select('test_table', {}); }; ### END ### The above results in an error: Can't locate object method "quick_select" via package "database" (perhaps you forgot to load "database"?) I'm forced to add "use Dancer2::Plugin::Database" to File 2. I'm curious to know if there's some way to import commonly used plugins into extension apps. Thanks!
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users