On Tue, 6 Dec 2016, Charlie Brady wrote:
> The reason for not using a namespace is that I want to use 'app' to set
> some defaults. For instance, I want to do these:
>
> app->defaults(layout => 'server_manager');
> app->log->level('warn');
> push @{app->renderer->paths}, '/etc/e-smith/web/panels/manager/templates';
...
> Perhaps I should be defining a 'ServerManager' plugin, and setting the
> common defaults inside the register() method there.
That doesn't seem to work either:
[root@dsfdsfd functions]# cat My/ML.pm
package My::ML;
use Mojolicious::Lite;
plugin 'AppDefault';
1;
[root@dsfdsfd functions]# cat Mojolicious/Plugin/AppDefault.pm
package Mojolicious::Plugin::AppDefault;
use Mojo::Base 'Mojolicious::Plugin';
sub register {
my ($self, $app, $conf) = @_;
$app->log->level('warn');
push @{$app->renderer->paths},
'/etc/e-smith/web/panels/manager/templates';
}
1;
[root@dsfdsfd functions]# perl -I. test.mount
String found where operator expected at /etc/e-smith/web/functions/one
line 9, near "get '/'"
(Do you need to predeclare get?)
Can't load application from file "/etc/e-smith/web/functions/one": syntax
error at /etc/e-smith/web/functions/one line 9, near "get '/'"
Compilation failed in require at (eval 79) line 1.
[root@dsfdsfd functions]#