How do I detect whether a module is installed or not?
For example, if a script is running as root, this would be useful:

if (Tk is not installed ) { # This is what I need.
  print "Do you want to install the Tk perl module? (y/n) [n] >> ";
  my $answer=<STDIN>;
  exit if ($answer!~/^[Yy]/);
  print "You will have to answer a few questions if CPAN is not
configured.\n";
  print "Installation may take a while\n";
  print "Press enter to continue\n";
  $answer=<STDIN>;
  system('perl -MCPAN -e \'CPAN::Shell->install("Tk")\'');
} 

use Tk;
etc. etc. Tk application here.

Pete


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to