CPAN utils

thibaultduponchelle

Tib

Posted on March 31, 2021

CPAN utils

CPAN utils

In this post I will present you some must-have-but-less-known CPAN utils πŸ‘ πŸ’ͺ 😎

  1. List outdated modules
  2. List latest changes
  3. Print dependencies tree
  4. List system requirements

List outdated modules

You can use cpan-outdated to get the list of your outdated modules.

$ cpan-outdated -p
Acme::Automatix
Alien::Plotly::Orca
Alien::SNMP::MAXTC
PPIx::QuoteLike
PPIx::Regexp
Enter fullscreen mode Exit fullscreen mode

Outdated modules you said?

The discrepancy is totally normal, since modules versions evolve on CPAN but not necessarily locally.

In my example, the list is very small because I updated all my modules very recently with cpan-outdated -p | cpanm (I don't really know why I did it but it was cool πŸ˜€).

Get latest changes

Use cpan-listchanges to get meaningful portions of changelog between the version installed locally versus the latest version on CPAN. Example with one of the outdated from my previous list:

$ cpan-listchanges PPIx::QuoteLike
=== Changes between 0.015 and 0.016 for PPIx-QuoteLike

0.016       2021-03-26  T. R. Wyant
    Add rt.cpan.org back to bug reporting methods. Long live RT!

    Get prerequisites up to snuff, and add xt/author/prereq.t to ensure
    they stay that way.

    Refactor authortest into three, so I do not have to generate stub
    files to test without optional modules.
Enter fullscreen mode Exit fullscreen mode

Print dependencies tree

Print the dependency tree with cpandeps

$ cpandeps JSON::Conditional
JSON::Conditional (dist: L/LN/LNATION/JSON-Conditional-1.00.tar.gz)
  JSON (dist: I/IS/ISHIGAKI/JSON-4.03.tar.gz)
    Test::More (dist: E/EX/EXODIST/Test-Simple-1.302183.tar.gz)
      File::Temp (dist: E/ET/ETHER/File-Temp-0.2311.tar.gz)
        Carp (dist: X/XS/XSAWYERX/Carp-1.50.tar.gz)
          Exporter (dist: T/TO/TODDR/Exporter-5.74.tar.gz)
          IPC::Open3 (dist: S/SH/SHAY/perl-5.32.1.tar.gz)
        File::Path (dist: J/JK/JKEENAN/File-Path-2.18.tar.gz)
          File::Spec::Functions (dist: X/XS/XSAWYERX/PathTools-3.75.tar.gz)
            Scalar::Util (dist: P/PE/PEVANS/Scalar-List-Utils-1.55.tar.gz)
        parent (dist: C/CO/CORION/parent-0.238.tar.gz)
      Storable (dist: X/XS/XSAWYERX/Storable-3.15.tar.gz)
        XSLoader (dist: S/SA/SAPER/XSLoader-0.24.tar.gz)
  Module::Metadata (dist: E/ET/ETHER/Module-Metadata-1.000037.tar.gz)
    Encode (dist: D/DA/DANKOGAI/Encode-3.08.tar.gz)
    lib (dist: S/SM/SMUELLER/lib-0.63.tar.gz)
    version (dist: L/LE/LEONT/version-0.9928.tar.gz)
      base (dist: R/RJ/RJBS/base-2.23.tar.gz)
  Struct::Conditional (dist: L/LN/LNATION/Struct-Conditional-1.00.tar.gz)
    Clone (dist: A/AT/ATOOMIC/Clone-0.45.tar.gz)
      B::COW (dist: A/AT/ATOOMIC/B-COW-0.004.tar.gz)
Enter fullscreen mode Exit fullscreen mode

You can also see the JSON::Conditional deps (here for perl 5.26.1) on deps.cpantester.org:
CPANDeps CPANTesters

Or a nice view (configurable) on cpandeps.grinnz.com:
CPANDeps grinnz

None of these 2 pages give the exact same result than the command line, I haven't checked why, we could discuss in comments (maybe something with dynamic/static).

List system requirements

Several modules require libraries or development kit that CPAN can't satisfy (even if Alien modules can often fill this gap). Having a CPAN module installation failing because a dependency is missing is "normal". It is like when you compile something, it fails while reporting a missing header because you need to install it before. To help you and automatic tests, Slaven Rezić gathered system dependencies for us in the tool cpan-sysdeps

$ cpan-sysdeps --cpanmod Imager
libfreetype6-dev
libgif-dev
libpng-dev
libjpeg-dev
libtiff5-dev
Enter fullscreen mode Exit fullscreen mode

I was mad when I discovered this module, come on MetaCPAN and hit the "++" button!

++

Conclusion

If you have more to add to this list, please share! πŸ˜„

πŸ’– πŸ’ͺ πŸ™… 🚩
thibaultduponchelle
Tib

Posted on March 31, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related