0

I need to call my own mojolicious command from command line, using specific mojolicius intallation (System version of mojolicius is too old, and I can't update it). How can I do this?

something like:

$ ./kraih-mojo-97e88d1/script/mojo my_app/script/my_app my_command

will be great!

  • You could take a look at perlbrew which will install a local copy of perl into ~/perl5 and then install Mojolicious into ~/perl5 using perlbrew's version of cpanm. Alternatively, if you're happy with your system perl, then use local::lib (search CPAN) and cpanm to install just libraries into ~/perl5 – Allan Jan 13 '14 at 15:57

2 Answers2

1

For quick-and-dirty solution try adding use lib '/path/to/kraih-mojo-97e88d1/lib'; statement to your my_app script and run command as

perl my_app/script/my_app my_command
melhesedek
  • 66
  • 3
0

If you want to do a similar thing to the answer by melhesedek, but without changing your code, try using the -I switch to the perl interpreter:

perl -I/path/to/kraih-mojo-97e88d1/lib my_app/script/my_app my_command

or you can use the PERL5LIB environment variable, which you could set in your local environment, or prefix the command, like so:

PERL5LIB=/path/to/kraih-mojo-97e88d1/lib ./my_app/script/my_app my_command

Also, I personally believe that the lib module is too magical for my taste. It's not readily apparent in every-day use, but it should NEVER be used in say CPAN code. Just fyi.

Joel Berger
  • 20,180
  • 5
  • 49
  • 104