CPAN.pm has /root as default home

A

amirkarger

Hi.

Our sysadmin installs a bunch of Perl stuff using CPAN.pm. I decided to
try and use CPAN.pm today, but I got this:

Your configuration suggests "/root/.cpan" as your
CPAN.pm working directory. I could not create this directory due
to this error: mkdir /root/.cpan: Permission denied at
/usr/local/lib/perl5/5.8.6/CPAN.pm line 553

In retrospect, that's not so surprising. CPAN::Config.pm says:

'cpan_home' => q[/root/.cpan],

Obviously I'm not allowed to write to there, but CPAN::Config.pm is
where CPAN.pm assumes it should put stuff unless you tell it otherwise
in ~/.cpan/CPAN/MyConfig.pm.

So here's my question: is it generally better to create a MyConfig.pm
before using CPAN.pm, or can we write
'cpan_home' => "$ENV{HOME}/.cpan"
(and do the same to build_dir etc.)?

The former solution requires every user who wants to use CPAN.pm to
create a .cpan before running cpan. More likely, they'll just decide
CPAN's not working. So I prefer the latter. Is there anything wrong
with using ENV{HOME}? How do other people handle this situation?

-Amir Karger
 
X

xhoster

Hi.

Our sysadmin installs a bunch of Perl stuff using CPAN.pm. I decided to
try and use CPAN.pm today, but I got this:

Your configuration suggests "/root/.cpan" as your
CPAN.pm working directory. I could not create this directory due
to this error: mkdir /root/.cpan: Permission denied at
/usr/local/lib/perl5/5.8.6/CPAN.pm line 553

In retrospect, that's not so surprising. CPAN::Config.pm says:

'cpan_home' => q[/root/.cpan],

Obviously I'm not allowed to write to there, but CPAN::Config.pm is
where CPAN.pm assumes it should put stuff unless you tell it otherwise
in ~/.cpan/CPAN/MyConfig.pm.

Last time I brought this up, I suggested that CPAN should, rather than just
complaining that you can't write into root's home directory, offer to
create and configure a new .cpan in your own home directory. Someone
replied that it does do this already, so I just dismissed it as my own
system's idiosyncricity.

So here's my question: is it generally better to create a MyConfig.pm
before using CPAN.pm, or can we write
'cpan_home' => "$ENV{HOME}/.cpan"
(and do the same to build_dir etc.)?

The former solution requires every user who wants to use CPAN.pm to
create a .cpan before running cpan. More likely, they'll just decide
CPAN's not working. So I prefer the latter. Is there anything wrong
with using ENV{HOME}?

It seems to have worked for me. I haven't exhaustively it, so I can't
say there is nothing wrong with it. One potential problem is that every
Tom, Dick, and Harry will be taking up disk space with their own
individual copies of hundreds of modules, whereas if they were forced to go
to the sysadmin there would be only one centralized copy of each module.

How do other people handle this situation?

Until just now, I haven't handled it. Where I was root, I didn't need to
handle it as I just installed what I wanted as root, and where I was not
root I had no opportunity to handle it.
-Amir Karger

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top