How to Install Perl CPAN Modules

What is the proper way now to install Perl modules from CPAN? I am running Komodo IDE 12.0 on Ubuntu 20.04.1.

I am trying to install Math::Prime::Util.

I tried following the instructions here but got the following error:

/bin/sh: 1: ppm: not found

I did install version 5.28 of ActivePerl but that doesn’t seem to have solved the issue.

According to this post, it looks like PPM is being replaced by the State Tool, which I also installed.

But I’m not sure if this is even the right tool to install modules.

Any help or guidance would be greatly appreciated.

Thanks in advance!

Samir

Hi Siparikhm,

You are correct that the state tool is the way to install modules now. Math::Prime::Util is available on the platform and Komodo 12 comes with the state tool. From the command line you can add it to your Perl 5.28.1 project. Since you already have a Perl project on the platform, you can start at the step called Activating your environment: https://docs.activestate.com/platform/state/getting-started/

If you have any further questions don’t hesitate to reach out.

Cheers,

-JR

Hi,

Thanks for the help. I think that worked. It looks like I first had to create an organization using the dashboard to which I had to add myself.

Once I did that, here are the steps I executed on the command line:

$ state auth
$ state init <org-name>/<project-name> --language=perl
$ state push
$ state pull
$ state activate <org-name>/<project-name>
$ exit

I went back into the Komodo editor and created a Perl script within the Project and was then able to execute it using the module I needed. You are correct in that it looked like it was already installed with my runtime.

Thanks again.

Samir

Ok, I may have spoken too soon. Another script within my project requires the Bit::Vector module. I ran
$ state install Bit::Vector and got the following results:

╔════════════════════╗
β•‘ Installing Package β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Updating Runtime
────────────────
Changes to your runtime may require some dependencies to be rebuilt.

Bit-Vector includes 1 dependencies, for a combined total of 62
dependencies.
  └─ Carp-Clan (2 dependencies)

Something Went Wrong
────────────────────
 x Could not install dependencies
 x The project is currently building. Please visit
https://platform.activestate.com/Samir-Parikh/aoc2020 to see the
progress.

Need More Help?
───────────────
 β€’ Run β†’ `state install --help` for general
help
 β€’ Visit the Forum β†’
https://community.activestate.com/c/state-tool/

I checked the project dashboard online and, after building for a few minutes, it appears that the Bit::Vector package is there. When I run the script that requires this module, I get another error in the Komodo IDE:

Can't locate Bit/Vector.pm in @INC (you may need to install the Bit::Vector module) (@INC contains: /home/username/Komodo-IDE-12/lib/support/dbgp/perllib /home/username/perl5/lib/perl5/5.30.0/x86_64-linux-gnu-thread-multi /home/username/perl5/lib/perl5/5.30.0 /home/username/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/username/perl5/lib/perl5 /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at line 4.
BEGIN failed--compilation aborted at line 4.

The output of state packages is also below:

╔══════════════════╗
β•‘ Listing Packages β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
  Name                 Version  
────────────────────────────────
  Bit::Vector          Auto     
  Math::Prime::Util    Auto

Any suggestions here would be greatly appreciated.

Thanks again.
Samir

Interesting, I will take a look at it here and get back to you.

Cheers,

-JR

1 Like