在自愿维护一个停滞的 CPAN 包 (GnuPG) 之后,我想改进安装文件,以便gpg
在找不到二进制文件(GnuPG 是一个包装器)时它们可以优雅地退出。在从其他软件包中寻求灵感之后,我想出了将其添加到 Makefile.PL 中:
my @paths = grep { -x "$_/gpg" } split /:/, $ENV{PATH}, $ENV{PGP_PATH};
unless ( scalar @paths ) {
print <<EOD;
I can't find the gpg binary on your system. If it's not installed in your usual PATH, set $ENV{PGP_PATH} to include where it can be found and try installing again.
EOD
exit(0);
}
WriteMakefile(
'NAME' => 'GnuPG',
'VERSION_FROM' => 'GnuPG.pm',
'EXE_FILES' => [ gpgmailtunl ],
'LICENSE' => 'GPL',
'LIBS' => [ @paths ],
);
这看起来很正常吗?