Why can't I simply copy installed Perl modules to other machines?

后端 未结 2 1289
独厮守ぢ
独厮守ぢ 2021-01-13 05:18

Being very new to Perl but not to dynamic languages, I\'m a bit surprised at how not straight forward the manage of modules is.

Sure, cpan X does theore

2条回答
  •  灰色年华
    2021-01-13 05:56

    In the external environment (Linux CentOs) it worked after hours because I don't have root access and I had to configure cpan to operate as a non-root user

    This is one of those times when it helps to know The Trick. In this case local::lib, which lets you configure a non-root install area and all the ENV variables in about three minutes.

    if perl's modules are written in perl, why the copy/past approach will not work?

    Some are written in Pure Perl, but many are written partially in C (using Perl's XS API) for efficiency.

    Sometimes you end up with situations like JSON::XS, JSON::PP and JSON::Any to autoselect the best one that is installed.

    Isn't there a way to download the module (tar, zip...) and use cpan to deploy it?

    The cpan program is all about getting things from the Internet. You can download the package (there will be a link along the lines of "Download: CGI.pm-3.49.tar.gz" on the right hand side of the CPAN page), untar it, then

    perl Makefile.PL
    make
    make install
    

    You would probably be better off configuring your cpan installation to use only HTTP sources (in the urllist config option). Possibly going to far as to create a mini CPAN mirror inside your network.

提交回复
热议问题