Mailing List Archive

Un-CPAN
I tried to get a bundle of Perl modules (and their dependencies) via
CPAN, but ran into problems. How can I get rid of the successfully
installed modules, the failed module installs, and CPAN itself? I
have everything I need in ebuilds now, so I'd like to start fresh and
do it the Gentoo way.

- Grant

--
gentoo-user@gentoo.org mailing list
Re: Un-CPAN [ In reply to ]
On 2004-09-18 11:59:29 -0700, Grant wrote:
> I tried to get a bundle of Perl modules (and their dependencies) via
> CPAN, but ran into problems. How can I get rid of the successfully
> installed modules, the failed module installs, and CPAN itself? I
> have everything I need in ebuilds now, so I'd like to start fresh and
> do it the Gentoo way.

Assuming the modules were well behaved, they were probably installed in
/usr/lib/perl5/site_perl. Be careful, though; some Gentoo ebuilds still
install files in site_perl (they should be using vendor_perl, IMO):

[10:35:28 dwc@fortuna ~]$ qpkg -f /usr/lib/perl5/site_perl
dev-lang/perl *
dev-perl/SGMLSpm *
media-gfx/imagemagick *

You can carefully look through /usr/lib/perl5/site_perl for files not
managed by Portage and remove them. There may be files elsewhere.
Unfortunately, without a list of modules, it's hard to recommend where
to look.

The modules that didn't build correctly most likely didn't touch the
filesystem, outside of the /root/.cpan directory.

Finally, Gentoo provides a script to install Perl modules via CPAN which
do not already have ebuilds - g-cpan.pl. You may want to check it out.

--
Daniel Westermann-Clark

--
gentoo-user@gentoo.org mailing list
Re: Un-CPAN [ In reply to ]
On Mon, 20 Sep 2004 10:40:44 -0400, Daniel Westermann-Clark
<daniel@acceleration.net> wrote:
>
>
> On 2004-09-18 11:59:29 -0700, Grant wrote:
> > I tried to get a bundle of Perl modules (and their dependencies) via
> > CPAN, but ran into problems. How can I get rid of the successfully
> > installed modules, the failed module installs, and CPAN itself? I
> > have everything I need in ebuilds now, so I'd like to start fresh and
> > do it the Gentoo way.
>
> Assuming the modules were well behaved, they were probably installed in
> /usr/lib/perl5/site_perl. Be careful, though; some Gentoo ebuilds still
> install files in site_perl (they should be using vendor_perl, IMO):
>
> [10:35:28 dwc@fortuna ~]$ qpkg -f /usr/lib/perl5/site_perl
> dev-lang/perl *
> dev-perl/SGMLSpm *
> media-gfx/imagemagick *
>
> You can carefully look through /usr/lib/perl5/site_perl for files not
> managed by Portage and remove them. There may be files elsewhere.
> Unfortunately, without a list of modules, it's hard to recommend where
> to look.
>
> The modules that didn't build correctly most likely didn't touch the
> filesystem, outside of the /root/.cpan directory.
>
> Finally, Gentoo provides a script to install Perl modules via CPAN which
> do not already have ebuilds - g-cpan.pl. You may want to check it out.
>
> --
> Daniel Westermann-Clark

Daniel,

I'm not as concerned with a clean filesystem as I am with using a
single package management system if I can help it. I'd like to
'emerge package' and have any and all perl modules required installed
as ebuilds. I'm thinking some won't install and be recorded because I
already have them via CPAN. Is there any way to rebuild these with
ebuilds even though I already have them? Maybe the method you
describe is the way to do this?

Also, g-cpan.pl didn't work for me with Bundle::InterchangeKitchenSink
as described here:

http://bugs.gentoo.org/show_bug.cgi?id=64466

It sounds like a very useful tool though.

- Grant

--
gentoo-user@gentoo.org mailing list
Re: Un-CPAN [ In reply to ]
On 2004-09-20 10:04:27 -0700, Grant wrote:
> I'm not as concerned with a clean filesystem as I am with using a
> single package management system if I can help it. I'd like to
> 'emerge package' and have any and all perl modules required installed
> as ebuilds. I'm thinking some won't install and be recorded because I
> already have them via CPAN. Is there any way to rebuild these with
> ebuilds even though I already have them? Maybe the method you
> describe is the way to do this?

CPAN isn't a package manager, so to speak. It doesn't provide a way to
uninstall modules once you've installed them (perl -MCPAN -e 'install
My::Module'). This is why I recommend carefully removing files from
/usr/lib/perl5/site_perl.

Otherwise, when you install the modules via Portage, you might run into
problems (depending on the order of your @INC directories). Gentoo's
Perl installation seems to put site_perl in front of vendor_perl:

[19:13:43 dwc@fortuna ~]$ perl -le 'print join "\n", @INC;'
/etc/perl
/usr/lib/perl5/site_perl/5.8.4/i686-linux
/usr/lib/perl5/site_perl/5.8.4
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.4/i686-linux
/usr/lib/perl5/vendor_perl/5.8.4
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.4/i686-linux
/usr/lib/perl5/5.8.4

It sounds like there's a good chance that you have two copies of some
modules lying around: one installed via CPAN (which probably lives in
site_perl), and one installed via Portage (which probably lives in
vendor_perl). Note how I said "probably", since CPAN makes it difficult
to know for sure. Once you've removed the CPAN copies, you can be
"safe" by remerging them (but it shouldn't make a difference).

I've polluted several filesystems over the years with modules installed
via CPAN instead of my package manager, and I usually regretted it
later.

> Also, g-cpan.pl didn't work for me with Bundle::InterchangeKitchenSink
> as described here:
>
> http://bugs.gentoo.org/show_bug.cgi?id=64466
>
> It sounds like a very useful tool though.

I haven't used g-cpan.pl to install a CPAN bundle. My guess is that it
chokes on them, but maybe you'll receive confirmation on that bug.

Generally speaking, my method of install Perl modules goes something
like this:

(1) Is it satisfied by Perl core modules, or is it already installed?
Something like:
perl -MFile::Spec -le 'print $File::Spec::VERSION;'
is usually enough to tell me if I already have the module.

(2) Is it available in Portage? Just use 'emerge search' on part of the
module's name, e.g. 'emerge search spec'.

If neither of these is satisfied, I try g-cpan.pl. Occasionally I'll
write my own ebuild and place it in my overlay. The perl-module eclass
makes it very easy.

For CPAN bundles, you can take a look at what modules it requires and
try steps (1) and (2) for each of the modules. You can use
http://search.cpan.org/ to see the list of modules required for a
bundle.

--
Daniel Westermann-Clark

--
gentoo-user@gentoo.org mailing list