command in app directory

38 views
Skip to first unread message

Tim

unread,
Jul 10, 2014, 10:59:43 AM7/10/14
to mojol...@googlegroups.com
Hi,

is it possible to store a Mojolicious::Command in the same directory as the Mojolicious::Lite app?

This works
push @{app->commands->namespaces}, 'commands';
 
package commands:testcmd;
use Mojo::Base 'Mojolicious::Command';
...

This not
push @{app->commands->namespaces}, '.';
 
package testcmd;
use Mojo::Base 'Mojolicious::Command';
...

Thanks 

Jan Henning Thorsen

unread,
Jul 14, 2014, 6:04:39 AM7/14/14
to mojol...@googlegroups.com
I would say it's a rather bad idea to store a module without an app prefix, like "MyApp::Command::whatever". Also, modules that are lowercase is supposed to be used as pragmas: http://perldoc.perl.org/perlpragma.html

Stefan Adams

unread,
Jul 14, 2014, 7:53:15 PM7/14/14
to mojolicious

On Mon, Jul 14, 2014 at 5:04 AM, Jan Henning Thorsen <jan.h...@thorsen.pm> wrote:
like "MyApp::Command::whatever". Also, modules that are lowercase is supposed to be used as pragmas: http://perldoc.perl.org/perlpragma.html

So wouldn't MyApp::Command::whatever be in violation of that convention?  Or is that a primary purpose to providing the local namespace such that for this subset of models for this app, it's OK to break convention.

Jan Henning Thorsen

unread,
Jul 15, 2014, 4:41:30 AM7/15/14
to mojol...@googlegroups.com
It's not all lowercase, so it doesn't break the convention. foo::bar == pragma. Foo::bar != pragma.
Reply all
Reply to author
Forward
0 new messages