Skip to content

Commit dde66eb

Browse files
avargitster
authored andcommitted
remote-mediawiki tests: use a more idiomatic dispatch table
Change the dispatch table code in test-gitmw.pl to use a hash where subroutine references are the values. This is more obvious than a hash where the values are strings we'll use to go searching around in the symbol table for the function. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9ff2958 commit dde66eb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

contrib/mw-to-git/t/test-gitmw.pl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ sub wiki_upload_file {
214214

215215
wiki_login($wiki_admin, $wiki_admin_pass);
216216

217-
my %functions_to_call = qw(
218-
upload_file wiki_upload_file
219-
get_page wiki_getpage
220-
delete_page wiki_delete_page
221-
edit_page wiki_editpage
222-
getallpagename wiki_getallpagename
217+
my %functions_to_call = (
218+
upload_file => \&wiki_upload_file,
219+
get_page => \&wiki_getpage,
220+
delete_page => \&wiki_delete_page,
221+
edit_page => \&wiki_editpage,
222+
getallpagename => \&wiki_getallpagename,
223223
);
224224
die "$0 ERROR: wrong argument" unless exists $functions_to_call{$fct_to_call};
225-
&{$functions_to_call{$fct_to_call}}(@ARGV);
225+
$functions_to_call{$fct_to_call}->(@ARGV);

0 commit comments

Comments
 (0)