I have tried to modify the default app to load a command from the
MyApp::Command namespace, but without success.
It works when I install the command in the Mojolicious::Command namespace.
What am doing wrong?
(Mojolicious 5.47)
script/my_app:
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
BEGIN { unshift @INC, "$FindBin::Bin/../lib" }
# Start command line interface for application
require Mojolicious::Commands;
my $commands = Mojolicious::Commands->new;
$commands->namespaces(['MyApp::Command']);
$commands->start_app('MyApp');
lib/MyApp/Command/mycommand.pm:
package MyApp::Command::mycommand;
use Mojo::Base 'Mojolicious::Command';
sub run {
my ($self, @args) = @_;
print "hello\n";
}
1;
$ ./script/my_app mycommand
Unknown command "mycommand", maybe you need to install it?
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.