Search code examples
perlcommand-line-interfacemoose

Why does a MooseX::App app not know any commands on a different machine


I have written a midsized CLI application. Once I copied it to our development server I noticed it doesn't recognize or know any of its commands if run there. I minimized the code to the following example which works in my local machine but not on the server. What cloud be the reason?

package MyApp;
use MooseX::App;

1;

package MyApp::Yay;
use MooseX::App::Command;

sub run {print "yay\n"}

1;

package main;

MyApp->new_with_command->run;

1;

Save that in a file my_app.pl and call it like:

perl my_app.pl yay

Expected output:

yay

On the development server the little application doesn't accept yay as a command nor does it list any command in the help. The output looks like this:

Unknown command 'yay'
usage:
    my_app.pl <command> [long options...]
    my_app.pl help
    my_app.pl <command> --help

global options:
    --help -h --usage -?  Prints this usage information. [Flag]

available commands:
    help  Prints this usage information

The software involved is:

  • local machine (working)
    • Perl v5.14.4
    • MooseX::App 1.30
  • development server (not working there)
    • Perl 5.10.0
    • MooseX::App 1.30

Unfortunately I cannot install different Perl versions on the development server but I doubt it's related to Perl itself. Update: It actually turned out that Perl 5.10.0 broke MooseX::App.

Does the program know the yay command when you execute it? Do you have any hint why it won't work?


Solution

  • 5.10.0 was a fairly buggy version of perl. Try another version using perlbrew.