Search code examples
perlinstallationofflinestrawberry-perlcpanm

How to install Perl modules with dependencies offline on Windows and Strawbery Perl?


I need to install Strawberry Perl and many Perl modules (with dependencies) on a Windows machine without the access to the internet (for security reasons).

Offline installation of Strawberry Perl works perfectly, but I did not manage to install additional modules I need.

I prepared a CPAN like repository on a Ubuntu machine using Pinto:

pinto --root my_repo init
pinto --root my_repo pull -M Some::Mudule1 Some::Mudule2

Then I transferred my_repo directory to the target machine as C:\some\path\my_repo and tried:

cpanm --mirror "file://C:/some/path/my_repo" --mirror-only Some::Mudule1 Some::Mudule2

But it ended up with error message:

! cannot open file 'C:\Users\dedek/.cpanm/sources/file%C%some%path%my_repo/02packages.details.txt.gz': No such file or directory opening compressed index
! Couldn't find module or a distribution Some::Mudule1
! cannot open file 'C:\Users\dedek/.cpanm/sources/file%C%some%path%my_repo/02packages.details.txt.gz': No such file or directory opening compressed index
! Couldn't find module or a distribution Some::Mudule2

Why is cpanm looking for such strange location? How can I fix it? Is there a simpler way how to install Perl modules offline? It would be also nice if I could prepare the CPAN like repository on a Windows machine. But I did not succeed to install Pinto on Windows, is it possible?


Solution

  • Finally I found my mistake. There is a symbolic link modules -> stacks/master/modules in the original CPAN like repository made by Pinto. And this link was discarded during the transfer (using WinSP). When I copied my_repo/stacks/master/modules to my_repo/modules everything worked correctly.

    I would really appreciate a more relevant error message from cpanm!