How can I install a CPAN module into a local directory?

前端 未结 5 1785
庸人自扰
庸人自扰 2020-11-22 16:17

I\'m using a hosted Linux machine so I don\'t have permissions to write into the /usr/lib directory.

When I try to install a CPAN module by doing the us

5条回答
  •  生来不讨喜
    2020-11-22 17:06

    I had a similar problem, where I couldn't even install local::lib

    I created an installer that installed the module somewhere relative to the .pl files

    The install goes like:

    perl Makefile.PL PREFIX=./modulos
    make
    make install
    

    Then, in the .pl file that requires the module, which is in ./

    use lib qw(./modulos/share/perl/5.8.8/); # You may need to change this path
    use module::name;
    

    The rest of the files (makefile.pl, module.pm, etc) require no changes.

    You can call the .pl file with just

    perl file.pl
    

提交回复
热议问题