Specify a file as the url in your cpanfile
j1n3l0

j1n3l0 @j1n3l0

Joined:
Mar 21, 2019

Specify a file as the url in your cpanfile

Publish Date: Aug 27 '20
11 2

Whilst it is not explicitly stated in the docs, you can specify a file path as the url for the dependency in a cpanfile:

requires "Module::Name",
  url => "file:///path/to/Module-Name-${VERSION}.tar.gz";

This can prove useful if (for example) you want to test local versions of your own modules and don't have or want a local CPAN mirror.

Comments 2 total

  • jwrightecs
    jwrightecsAug 12, 2021

    This only works with carton, not with cpanm --installdeps .

    • j1n3l0
      j1n3l0Nov 12, 2021

      Thanks for the comment.

      I have the following cpanfile:

      requires 'Bean::Crypt', url => 'file:///~/.src/p5-bean-crypt/Bean-Crypt-1.01.tar.gz';
      
      Enter fullscreen mode Exit fullscreen mode

      And I do however find that it works with on my system as expected:

      cpanm --installdeps .
      Successfully installed Type-Tiny-1.012004
      Successfully installed CryptX-0.074
      Successfully installed Bean-Crypt-1.02
      3 distributions installed
      
      Enter fullscreen mode Exit fullscreen mode

      I am using the following cpanm version:

      cpanm -V
      cpanm (App::cpanminus) version 1.7044 (~/.plenv/versions/5.30.0/bin/cpanm)
      perl version 5.030000 (~/.plenv/versions/5.30.0/bin/perl5.30.0)
      
      Enter fullscreen mode Exit fullscreen mode
Add comment