Search code examples
perlcpan

how to install GnuPG::Interface perl module on windows?


When I try to do this : cpan install GnuPG::Interface either on Strawberry or Activeperl ( windows ) I get this error : I use last perl version available 5.26.1.1

CPAN: File::Temp loaded ok (v0.2304)
CPAN: YAML::XS loaded ok (v0.66)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20170821)
Configuring A/AL/ALEXMV/GnuPG-Interface-0.52.tar.gz with Makefile.PL
which gpg ... 'which' is not recognized as an internal or external command,
operable program or batch file.
gpg (GnuPG) not found at Makefile.PL line 7.
 Warning: No success on command[C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=si
te]
   ALEXMV/GnuPG-Interface-0.52.tar.gz
   C:\Perl64\bin\perl.exe Makefile.PL INSTALLDIRS=site -- NOT OK

Any tip ? Im actually trying to install Mail::GnuPG but GnuPG::Interface is required. thank you


Solution

  • This line in Makefile.PL:

    system("which", "gpg");
    die "gpg (GnuPG) not found" if ( $? != 0 );
    

    is attempting to check if gpg exists in your %PATH% but since you do not have the standard *nix utility which, it fails. You can install Perl's App::pwhich and replace that line with system("pwhich", "gpg"); if you want or, if you know that gpg is in your %PATH%, delete that line from Makefile.PL entirely.

    Alternatively, you can install Git for Windows which will provide both which and gpg along with perl 5.24.1.

    If one were to rewrite this Makefile.PL from scratch, I would recommend using File::Which to check for all locations on your %PATH% where a gpg executable exists.