2

My mac machine is quite old (Mac OS X 10.6.8) and I have a question on how to upgrade a perl module File::Path.

I mostly compile my LaTeX document using latexmk which is basically a perl script. It requires File::Path version 2.08 but I got an outdated one (version 2.07_02) in my machine. This is the error message I got while running the latexmk command.

>> latexmk doc.tex File::Path version 2.08 required--this is only version 2.07_02 at /usr/texbin/latexmk line 129. 

When I ran cpan as a non-root user and tried to upgrade this package by running the command upgrade File::Path, I got this message on the screen.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR: Can't create '/Library/Perl/Updates/5.10.0/File' mkdir /Library/Perl/Updates/5.10.0/File: Permission denied at /System/Library/Perl/5.10.0/ExtUtils/Install.pm line 479 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! at -e line 1 make: *** [pure_perl_install] Error 13 DLAND/File-Path-2.09.tar.gz /usr/bin/make install -- NOT OK Warning (usually harmless): 'YAML' not installed, will not store persistent state Failed during this command: DLAND/File-Path-2.09.tar.gz : install NO 

Is it possible to upgrade a perl module as a non-root user using cpan in Mac OS X?

0

1 Answer 1

2

You can't modify the existing installation as non-root. But you can install a CPAN module in your home directory (or wherever you have write access) and then load that module preferentially (in most cases. It is possible for there to be conflicts between modules, but you're probably okay here).

There are instructions for doing this via the cpan tool in the perlfaq. But it can be a bit fiddly. Using cpanm is often recommended.

https://stackoverflow.com/questions/2980297/how-can-i-use-cpan-as-a-non-root-user has detailed instructions for installing cpanm.

Then when installed, you just need to use it instead of the system module. There are several ways to do so.

You can set PERL5LIB to your local directory. As an example:

$ export PERL5LIB=~/perl5 $ perl myprog 

If you just need to do this for a small number of scripts, you can add the path in the script itself:

#!/bin/perl use lib '/home/me/perl5'; use File::Path; 

Either of those should suffice for you, but if you're just testing things, you can also add a location to the path temporarily like this

$ perl -I ~/perl5 myprog 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.