willymacoy has asked for the wisdom of the Perl Monks concerning the following question:

I use OpenBSD and I reinstall every 18 months (at the most). I have scripts that set up my environment just so - based partly on what was there before.

I use the OpenBSD packages of CPAN modules where I can, followed by others directly from CPAN using the cpan utility.

Can I find out what I have installed using the cpan utility? I have found ~/.cpan/Metadata and ~/.cpan/Build. Do all of my cpan installed packages leave a trail in ~/.cpan/Build? The Metadata file doesn't appear to be what I want.

Replies are listed 'Best First'.
Re: What modules are installed?
by Khen1950fx (Canon) on Apr 18, 2011 at 10:00 UTC
    Give this a try. Warning: It lists everything.
    #!/usr/bin/perl use strict; use warnings; use Perl::Installed; use Data::Dumper::Concise; my $perl = Perl::Installed->new( prefix => '/usr' ); my @files = $perl->files(); print Dumper(@files); my $cfg = $perl->config(); print "$cfg->{version} on $cfg->{osname}\n";
Re: What modules are installed?
by educated_foo (Vicar) on Apr 18, 2011 at 13:06 UTC
Re: What modules are installed?
by anonymized user 468275 (Curate) on Apr 18, 2011 at 09:49 UTC
    I don't know if there is, but it isn't my approach to the problem. Given that Perl is only part of what is needed on a *nix system, my personal way is to keep an installation directory under the root home directory (default varies according to type of *nix) which further contains pending, installed and removed subdirectories. The contents of these (which may be backed up and truncated to just the top directory showing still the product or module and the version in question) reflect everything ever installed or removed for the current O/S version, including from CPAN. It is particularly useful when managing product dependencies manually to have a pending area so that when a conflict occurs or a chain of dependencies is uncovered pointwise, you can drill down without losing track of what remains to be installed including what has been removed pending the search for an alternative distro. In addition I maintain a logbook of what is installed and removed with a comment as to what the intention was, e.g. to resolve a missing dependency for a desired product.

    One world, one people

      This looks like a good system, thanks. But I don't think I am disciplined enough in this respect to make it work. I'll sometimes install a package 'just to see' with every intention of making a note - but not actually making that note.

      However I am extremely disciplined when it comes to standardisation and organisation. So if I can write a script to interrogate the status of the system, I know it'll get everything that I need because everything really does go in the right place.

      I haven't had any dependency issues yet. OpenBSD kind of shields me from that kind of thing, since I usually only install using its package system

Re: What modules are installed?
by planetscape (Chancellor) on Apr 18, 2011 at 15:04 UTC