Recently I got myself a new phone. And, as one does, I installed Termux on it, to have a unix-ish environment for when I need it.
Then, of course, I went to configure Perl and install some modules I'd like there. As this was not my first time doing so, I thought about listing all the modules I want in a cpanfile and then using App::cpanminus to install these, making the process far more reproducible.
But that required some non-Perl prerequisites, like the C compiler, make and perl itself. And of course, also bootstrapping App::cpanminus.
Then I thought a bit on how to combine this setup into a single file. This is what I came up with. It's a cpanfile that doubles as shell script.
#!/bin/bash # This will install cpanminus and then the Perl modules # as listed at the end of this script. To run use # the following commands: # # chmod ugo+x ./cpanfile && ./cpanfile # eval ' pkg install git perl make clang if ! cpanm --help 2>&1 >/dev/null ; then curl -L https://cpanmin.us | perl - App::cpanminus fi DIR=$(dirname "$0") cpanm --installdeps --notest --cpanfile "$DIR" exit ' if 0; requires 'Mojolicious'; requires 'DBIx::Spreadsheet'; #requires 'App::sqldisplay'; # to be released on CPAN requires 'DBIx::RunSQL';
Why not the other way around? Because I could not find a way to make cpanm take a file with a different name than cpanfile :)
The cpanfile is also available on Github, if you want to copy it.
In reply to A cpanfile polyglot - for setting up Perl on Termux by Corion
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |