Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

force module install with CPAN

Tags:

perl

I know it's easy to install a module with 'force' using CPAN from command prompt. I am trying to achieve same through the script:

use CPAN;
eval "use Filesys::DiskSpace" or do {
    CPAN::install("Filesys::DiskSpace");
};

Is there any way to add the option 'force' to the code? I am having the following error while compiling the module:

  make test had returned bad status, won't install without force

The warnings could not be serious, so I would like to proceed with the installation. Thanks.

like image 532
Andrew Avatar asked Dec 21 '22 02:12

Andrew


1 Answers

Looks like you'll need to instantiate CPAN to a variable and call the force() method on it

my $cpan = CPAN->new;
$cpan->force();
$cpan->install("Filesys::DiskSpace");
like image 172
Glen Solsberry Avatar answered Dec 29 '22 17:12

Glen Solsberry