diff --git a/bin/account-manager.pl.in b/bin/account-manager.pl.in index 729f12d63537a2ec940a4958e4ee630ea803f310..5b963ce1c8445fe520f610b34d5f5141722a5119 100755 --- a/bin/account-manager.pl.in +++ b/bin/account-manager.pl.in @@ -4,8 +4,6 @@ use strict; use warnings; use utf8; use lib qw(@modulesdir@); -use feature "switch"; -no if $] >= 5.017011, warnings => 'experimental::smartmatch'; use Config::Tiny; use Data::Dumper; @@ -62,21 +60,19 @@ AccountManager::DB->register_db( my $db = AccountManager::DB->new(); -for ($action) { - when ('add_account') { add_account() } - when ('list_accounts') { list_accounts() } - when ('add_service') { add_service() } - when ('list_services') { list_services() } - when ('add_token') { add_token() } - when ('get_token') { get_token() } - when ('list_tokens') { list_tokens() } - when ('parse_metadata') { parse_metadata() } - default { - pod2usage( - -message => "invalid action '$action', aborting\n", - -verbose => 0 - ); - } +SWITCH: { + if ($action eq 'add_account') { add_account(); last SWITCH; } + if ($action eq 'list_accounts') { list_account(); last SWITCH; } + if ($action eq 'add_service') { add_service(); last SWITCH; } + if ($action eq 'list_services') { list_services(); last SWITCH; } + if ($action eq 'add_token') { add_token(); last SWITCH; } + if ($action eq 'get_token') { get_token(); last SWITCH; } + if ($action eq 'list_tokens') { list_tokens(); last SWITCH; } + if ($action eq 'parse_metadata') { parse_metadata(); last SWITCH; } + pod2usage( + -message => "invalid action '$action', aborting\n", + -verbose => 0 + ); } sub add_account {