Perl

How can you install cpanm and a Perl module?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

There are some different alternatives to install Perl modules. We will use cpanm.

  • Install cpanm:
$ cpan App::cpanminus
  • Install the Test module with cpanm:
cpanm Test

Now we can test the Test installed module:

$ perl -M'Test::Simple tests => 1' -e 'ok( 1 + 1 == 2 );'
1..1
ok 1
$ perl -M'Test::Simple tests => 1' -e 'ok( 1 + 1 == 3 );'
1..1
not ok 1
#   Failed test at -e line 1.
# Looks like you failed 1 test of 1.