Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify variables for module installations with cpan?

Tags:

perl

cpan

During installation with cpan (e.g. cpan XML:Parser) source code is compiled and sometimes requires additional variables to be set (in the example EXPATLIBPATH and EXPATINCPATH). cpan prints a helpful message what needs to be specified, but says that the specification needs to be ''Makefile'' argument/variables - when running cpan that doesn' add up.

I tried to specify environement variables with env (only INC is recognized for C includes, but the value is trimmed after the first space, so adding a -L directive doesn't work) and appending the variables which makes cpan search for modules with the variable name and argument. The manpage of cpan leaves this (quite crucial) matter completely uncovered. Setting LD_LIBRARY_PATH to the prefix I installed expat to doesn't work (header files isn't found).

If there's not a generic way, then I'd appreacite a solution for the cpan XML::Parser installation. I don't have root permissions on the system, so I need to specify the variables.

I use cpan 1.61 with perl 5.20.2 on Ubuntu 15.04 with Linux 4.0.1.

like image 272
Kalle Richter Avatar asked Dec 12 '25 22:12

Kalle Richter


1 Answers

You can always do

  • install cpanm if you don't have it, with curl -L https://cpanmin.us | perl - App::cpanminus
  • cpanm --look XML::Parser

That'll download the needed tarballs, unpack, and open a shell inside the distribution. So you're free to do:

  • perl Makefile.PL
  • make with any options you need (like setting EXPATLIBPATH)
  • make test
  • (sudo) make install
like image 114
dams Avatar answered Dec 15 '25 17:12

dams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!