Problem with implementing custom command in Mojolicious::Lite app

59 views
Skip to first unread message

Pavel Serikov

unread,
Mar 10, 2017, 6:48:27 AM3/10/17
to Mojolicious
Hello everyone,

I'm trying to implement custom command in my app like described in cookbook.

Custom namespace is loaded, however command doesn't work:

pavel@pavel-Inspiron-3542:/projects/bom$ socialbom cmd1
Unknown command "cmd1", maybe you need to install it?
Compilation failed in require at /usr/local/bin/socialbom line 14, <DATA> line 1.

What am I doing wrong?

Luc Didry

unread,
Mar 10, 2017, 7:03:06 AM3/10/17
to mojol...@googlegroups.com, Pavel Serikov
vendredi 10 mars 2017, 03:48:27 CET Pavel Serikov wrote:
> Hello everyone,
>
> I'm trying to implement custom command
> <https://github.com/pavelsr/SocialBOM/blob/master/lib/App/SocialBOM/Command/cmd1.pm>
> in my app <https://github.com/pavelsr/socialbom> like described in cookbook
> <http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Adding-commands-to-Mojolicious>
> .
>
> Custom namespace is loaded, however command doesn't work:
>
> pavel@pavel-Inspiron-3542:/projects/bom$ socialbom cmd1
> Unknown command "cmd1", maybe you need to install it?
> Compilation failed in require at /usr/local/bin/socialbom line 14, <DATA>
> line 1.
>
> What am I doing wrong?
>
>

Just a guess : in
https://github.com/pavelsr/SocialBOM/blob/master/lib/App/SocialBOM.pm#L197, you
should put
push @{app->commands->namespaces}, 'App::SocialBOM::Command';
instead of
push @{app->commands->namespaces}, 'App::SocialBOM::Command::cmd1';
--
Luc
https://fiat-tux.fr/
https://luc.frama.io/
Internet n'est pas compliqué, Internet est ce que vous en faites.

Pavel Serikov

unread,
Mar 10, 2017, 7:22:21 AM3/10/17
to Mojolicious, pavel.p...@gmail.com, l...@didry.org
You are absolutely right, it's mine inattention :)
Question closed.

пятница, 10 марта 2017 г., 15:03:06 UTC+3 пользователь Luc Didry написал:
Reply all
Reply to author
Forward
0 new messages