I'm using the following code to install a Perl module but it's prompting some questions during the installation:
BEGIN{
unless( eval { require Archive::Extract } ){
require CPAN;
CPAN::Shell->force("install","Archive::Extract");
}
}
use Archive::Extract;
The matter is some old Perl installations (like 5.8
) don't contain this useful module and I'm not sure what to use instead of it ))
I have tried different ways to work around this problem, like using PERL_MM_USE_DEFAULT=1
in the code but still with no luck. This forum contains some answers like to define a hash with the default settings but these ways are too complicated for a newbee.
Is there any simpler way to install a module with no prompt? Thank you very much.
Update: I am using different Linux derivatives like Ubuntu 10.04, CentOS 6 and so on. I am installing a piece of software with the help of this script (for my personal use only).