#!/usr/bin/env perl

$file = "perl.modules.sh";

open (FILE, $file) || die "ERROR: can't open perl module list: $file\n";
@list = <FILE>;
close (FILE);

# set the psconfig version:
if ("$version" eq "") {
    $version = $ENV{'PSVERSION'};
}
if ("$version" eq "") {
    $version = "default";
}

$prefix = `csh psconfig.sh --prefix $version`;
$homedir = `pwd`;

foreach $module (@list) {
    chomp $module;
    
    if (eval "use $module; 1") {
	print "$module: found\n";
    } else {
	print "$module: missing\n";
	# try to build the module from ../../extperl/Module.*.tar.gz
	chdir "../../extperl";

	print "looking for $module\n";
	system ("ls");

	# does the module tarball or directory exist?
	@targets = <$module*.tar.gz>;
	
	foreach $file (@targets) {
	    print "file: $file\n";
	}

	chdir $homedir;
    }
}
