#!/usr/bin/perl -w # # whichmod: find out which modules we have installed, # and print them in the order they were installed, # leaving out duplicates. use strict; use CPAN; use Config; use File::Copy; use File::Spec; use File::Spec::Functions qw/:ALL/; # Print modules in installation order. my $modname; my $fh; my %found = (); my $podfile = catfile($Config{'archlibexp'}, 'perllocal.pod'); open($fh, "< $podfile") || die "$podfile: can't read: $!\n"; while (<$fh>) { if (m/.*C L<(.*)>/) { my ($module) = split /\|/, $1, 0; my $mod = expand('Module', $module); next unless $mod && $mod->inst_version; unless ($found{$module}) { printf "%35s %s", $mod->id, $mod->inst_version; printf " (%s)", $mod->cpan_version if $mod->inst_version ne $mod->cpan_version; printf "\n"; } $found{$module} = 1; } } close($fh); exit(0);