DEV Community

j1n3l0
j1n3l0

Posted on

Specify a file as the url in your cpanfile

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.

Top comments (2)

Collapse
 
jwrightecs profile image
jwrightecs

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

Collapse
 
j1n3l0 profile image
j1n3l0

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