[openpgp-applet] 41/61: replace Switch module with suitable for() block
Clément Hermann
nodens-guest at moszumanska.debian.org
Sat Aug 15 19:15:48 UTC 2015
This is an automated email from the git hooks/post-receive script.
nodens-guest pushed a commit to annotated tag OpenPGP_Applet-0.9
in repository openpgp-applet.
commit c87fb47b1db3dbf92a941f9d3a55fd7f74739034
Author: Clément Hermann (nodens) <nodens at nodens.org>
Date: Fri Nov 28 12:54:25 2014 +0100
replace Switch module with suitable for() block
Switch module is deprecated since perl 5.14, and given/when is
experimental. This is the safe, compatible way according to perl documentation.
---
bin/openpgp-applet | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/bin/openpgp-applet b/bin/openpgp-applet
index 053b9d2..eaaf516 100755
--- a/bin/openpgp-applet
+++ b/bin/openpgp-applet
@@ -65,7 +65,6 @@ use Crypt::OpenPGP_Applet::GnuPG::Interface;
use IO::Handle;
use I18N::Langinfo qw{langinfo CODESET};
use List::MoreUtils qw{none};
-use Switch;
use DateTime;
use File::ShareDir;
@@ -320,21 +319,23 @@ sub get_status {
my $status;
my $trusted;
# Below taken from doc/DETAILS in GnuPG's sources
- switch ($code) {
- case "o" { $trusted = FALSE;
- $status = $encoding->decode(gettext("Unknown Trust")); }
- case "-" { $trusted = FALSE;
- $status = $encoding->decode(gettext("Unknown Trust")); }
- case "q" { $trusted = FALSE;
- $status = $encoding->decode(gettext("Unknown Trust")); }
- case "m" { $trusted = FALSE;
- $status = $encoding->decode(gettext("Marginal Trust")); }
- case "f" { $trusted = TRUE;
- $status = $encoding->decode(gettext("Full Trust")); }
- case "u" { $trusted = TRUE;
- $status = $encoding->decode(gettext("Ultimate Trust")); }
- else { return; }
- }
+ SWITCH:
+ for ($code){
+ if ($_ eq "o") { $trusted = FALSE;
+ $status = $encoding->decode(gettext("Unknown Trust")); last SWITCH; }
+ if ($_ eq "-") { $trusted = FALSE;
+ $status = $encoding->decode(gettext("Unknown Trust")); last SWITCH; }
+ if ($_ eq "q") { $trusted = FALSE;
+ $status = $encoding->decode(gettext("Unknown Trust")); last SWITCH; }
+ if ($_ eq "m") { $trusted = FALSE;
+ $status = $encoding->decode(gettext("Marginal Trust")); last SWITCH; }
+ if ($_ eq "f") { $trusted = TRUE;
+ $status = $encoding->decode(gettext("Full Trust")); last SWITCH; }
+ if ($_ eq "u") { $trusted = TRUE;
+ $status = $encoding->decode(gettext("Ultimate Trust")); last SWITCH; }
+ return;
+
+ }
return ($status, $trusted);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/openpgp-applet.git
More information about the Pkg-perl-cvs-commits
mailing list