#!/usr/bin/perl -w # Which distribution do these modules come from? # # Arguments: # Text file containing data from CPAN # List of modules { my ( $cpanList, $localList ) = @ARGV; my %list; # Load up the CPAN information. open ( CPAN, $cpanList ) or die "Unable to open $cpanList: $!"; # Skip the file header. while() { next if ( /^\S+:\s+/ ); next if ( /^\s*$/ ); last; } # Load data into a Hash for later retrieval. while() { my ( $module, undef, $distro ) = split(' ',$_); $distro =~ s#^.+/##; $list{$module} = $distro; } close ( CPAN ); # Look through the list of the modules, outputting which distro # contains that module. open ( LIST, $localList ) or die "Unable to open $localList: $!"; while () { chomp; if ( defined($list{$_} ) ) { printf ( "%30s comes from %s\n", $_, $list{$_} ); } else { print "Not able to find out where $_ came from.\n"; } } close ( LIST ); }