develooper Front page | perl.qa | Postings from October 2007

Re: Running CPAN as a regular user, installing as root

From:
A. Pagaltzis
Date:
October 18, 2007 19:53
Subject:
Re: Running CPAN as a regular user, installing as root
* Matisse Enzer <matisse@matisse.net> [2007-10-18 19:35]:
> From your shell prompt:
>
>   sudo cpan

No, if you used to use CPAN.pm as root, then instead say this:

    sudo tar cf - .cpan -C ~root | tar xvf - -C ~
    sudo rm -r ~root/.cpan

The first line simply produces a copy of .cpan from ~root in your
own home directory, but owned by yourself. (Basically a more
transactional way to do `cp -R && chown`.)

After that, replace all references to ~root in
.cpan/CPAN/MyConfig.pm with references to your own home, eg.

    perl -pi~ -e'BEGIN{$root=shift} s/\Q$root/$ENV{HOME}/' ~root .cpan/CPAN/MyConfig.pm

Then you can invoke `cpan` as a regular user right away in order
to make your config changes.

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About