Subject: | Mail::GnuPG bug report: parsing of verify results |
Date: | Fri, 2 Aug 2013 12:13:20 -0400 |
To: | bug-Mail-GnuPG [...] rt.cpan.org |
From: | Jamie McClelland <jamie [...] mayfirst.org> |
Hi - thanks for the Mail::GnuPG perl library!
I had trouble with getting proper results when running the verify
function that seem caused by an improper regular expression.
There's a comment in the code:
# FIXME: these regex are likely to break under non english locales.
Which is true... I've attached a simple patch that should preserve
backward compatibility. It returns the entire result of the verify
command so that the calling script can handle parsing, dealing with
locales, etc.
I hope you find it useful.
jamie
diff --git a/GnuPG.pm b/GnuPG.pm
index 3a1d224..6aa8750 100644
--- a/GnuPG.pm
+++ b/GnuPG.pm
@@ -220,7 +220,7 @@ sub decrypt {
my ($keyid) = $result =~ /using \S+ key ID (.+)$/m;
my ($pemail) = $result =~ /Good signature from "(.+)"$/m;
- return ($exit_value,$keyid,$pemail);
+ return ($exit_value,$keyid,$pemail,$result);
}
@@ -460,7 +460,7 @@ sub verify {
my ($pemail) = $result =~ /Good signature from "(.+)"$/m;
- return ($exit_value,$keyid,$pemail);
+ return ($exit_value,$keyid,$pemail,$result);
}
--
Jamie McClelland
May First/People Link
Growing networks to build a just world
http://www.mayfirst.org
https://support.mayfirst.org
OpenPGP Key: http://current.workingdirectory.net/pages/identity/
Message body not shown because it is not plain text.