[Chicago-talk] "I don't have permission to install amoduleonthesystem!"

Mike Fragassi frag at ripco.com
Mon Dec 29 22:07:43 CST 2003

On Mon, 29 Dec 2003, petemar1 wrote:

> Does anyone have a sample .cpan file?

First, the file is not ~/.cpan, but ~/.cpan/CPAN/MyConfig.pm.
Second, the argument that you need is

  'makepl_arg' => q[PREFIX=/your/home/dir/here],

Allegedly you can make do with '~', but I seem to have had some problems
with that.

If you do not already have the MyConfig.pm file, simply locate the root
user's CPAN/Config.pm, and copy it to that location, and make the changes.
Also, once you've done that, replace all references to '/root/' with
'/your/home/dir/here', except for the paths of executables, like lynx,
make, ftp, etc.

(Note that PREFIX is really an argument for ExtUtils::MakeMaker, and gets
passed to the 'perl Makefile.PL' stage.  If you ever find yourself having
to install a perl module outside of the CPAN shell, i.e. by ftping a
module, untar/zipping it, etc., all you need to do is run 'perl
Makefile.PL PREFIX=/your/home' instead of 'perl Makefile.PL'; all the
other steps in the installation process don't need to be changed.  If you
have to do this often, just create a shell alias -- call it 'mymakeperl'
or something.

Also note that ExtUtils::MakeMaker "has issues"[1], and Module::Build
is being increasingly adopted as a replacement, much like CPANPLUS is
intended as a replacement of CPAN.pm.)

Finally, to use your new, personal ~/lib, be sure to set the following in
your .bash_profile (or whichever):


Or just make sure that all your programs 'use lib qw(/your/home/lib);'.

I highly recommend jumping through these hoops to avoid polluting the root
set of modules, even on systems where you do have root access.  Once I
upgraded to the latest copy of CGI.pm, only to discover that the upgrade
actually broke the way that -style parameters were used.  (I'm pretty sure
this has been fixed, incidentally.)  Because I only installed into my
~/lib, I could just nuke that and revert to the default module, and I
could breathe easy knowing I hadn't affected any other user's scripts.

Similarly, when editing MyConfig.pm, I recommend

	'prerequisites_policy' => q[ask],

and not 'follow'.

-- Mike F.


More information about the Chicago-talk mailing list