Subject: | Crypt-OpenPGP-1.03 windows unfriendly paths (patch) |
The paths Crypt-OpenPGP uses to find keys aren't windows friendly.
Attached are patches to address this issue.
$ENV{HOME} doesn't exist on windows, so I've changed it to use File::HomeDir
And I've also changed it to use File::Spec
This is tested on perl 5.8.8, build with mingw gcc 3.4.5, on windows XP
(not cygwin)
Subject: | OpenPGP.pm.patch |
--- OpenPGP.pm.orig Tue Dec 10 01:43:00 2002
+++ OpenPGP.pm Fri Apr 21 14:20:45 2006
@@ -7,4 +7,6 @@
$VERSION = '1.03';
+use File::HomeDir;
+use File::Spec;
use Crypt::OpenPGP::Constants qw( DEFAULT_CIPHER );
use Crypt::OpenPGP::KeyRing;
@@ -27,6 +29,11 @@
{
my $env = sub {
- my $dir = shift; my @paths;
- if (exists $ENV{$dir}) { for (@_) { push @paths, "$ENV{$dir}/$_" } }
+ my ($dir, $files) = @_;
+ $dir = $dir eq 'HOME' ? File::HomeDir->my_home() : $ENV{dir};
+ my @paths;
+ if ($dir) {
+ push @paths,
+ File::Spec->catfile($dir, (ref($files) ? @$files : $files));
+ }
return @paths ? @paths : ();
};
@@ -40,13 +47,13 @@
'PubRing' => [
$env->('PGPPATH','pubring.pgp'),
- $env->('HOME', '.pgp/pubring.pgp'),
+ $env->('HOME', [qw/.pgp pubring.pgp/]),
],
'SecRing' => [
$env->('PGPPATH','secring.pgp'),
- $env->('HOME', '.pgp/secring.pgp'),
+ $env->('HOME', [qw/.pgp secring.pgp/]),
],
'Config' => [
$env->('PGPPATH', 'config.txt'),
- $env->('HOME', '.pgp/config.txt'),
+ $env->('HOME', [qw/.pgp config.txt/]),
],
},
@@ -59,13 +66,13 @@
'PubRing' => [
$env->('PGPPATH','pubring.pkr'),
- $env->('HOME', '.pgp/pubring.pkr'),
+ $env->('HOME', [qw/.pgp pubring.pkr/]),
],
'SecRing' => [
$env->('PGPPATH','secring.skr'),
- $env->('HOME', '.pgp/secring.skr'),
+ $env->('HOME', [qw/.pgp secring.skr/]),
],
'Config' => [
$env->('PGPPATH', 'pgp.cfg'),
- $env->('HOME', '.pgp/pgp.cfg'),
+ $env->('HOME', [qw/.pgp pgp.cfg/]),
],
},
@@ -79,13 +86,13 @@
'Config' => [
$env->('GNUPGHOME', 'options'),
- $env->('HOME', '.gnupg/options'),
+ $env->('HOME', [qw/.gnupg options/]),
],
'PubRing' => [
$env->('GNUPGHOME', 'pubring.gpg'),
- $env->('HOME', '.gnupg/pubring.gpg'),
+ $env->('HOME', [qw/.gnupg pubring.gpg/]),
],
'SecRing' => [
$env->('GNUPGHOME', 'secring.gpg'),
- $env->('HOME', '.gnupg/secring.gpg'),
+ $env->('HOME', [qw/.gnupg secring.gpg/]),
],
},
Subject: | Makefile.PL.patch |
--- Makefile.PL.orig Tue Dec 10 01:48:09 2002
+++ Makefile.PL Fri Apr 21 14:04:18 2006
@@ -20,4 +20,6 @@
'LWP::UserAgent' => 0,
'URI::Escape' => 0,
+ 'File::HomeDir' => '0.56',
+ 'File::Spec' => 0,
'Crypt::DSA' => 0,