]> Sergey Matveev's repositories - public-inbox.git/commitdiff
xapcmd: simplify sub reference
authorEric Wong <e@yhbt.net>
Wed, 12 Aug 2020 09:17:14 +0000 (09:17 +0000)
committerEric Wong <e@yhbt.net>
Thu, 13 Aug 2020 02:22:52 +0000 (02:22 +0000)
We don't need to fully-qualify when referring to subs in
the same namespace, nor do we need make a SCALAR ref only
to dereference it

(Yes, still learning Perl :x)

lib/PublicInbox/Xapcmd.pm

index 348621cef0bfd724eb9366d69e9ffd05294def30..6fcc9e90cd42e45d22eee17993bf2edc84fec028 100644 (file)
@@ -253,7 +253,7 @@ sub _run {
 
 sub run {
        my ($ibx, $task, $opt) = @_; # task = 'cpdb' or 'compact'
-       my $cb = \&${\"PublicInbox::Xapcmd::$task"};
+       my $cb = \&$task;
        PublicInbox::Admin::progress_prepare($opt ||= {});
        defined(my $dir = $ibx->{inboxdir}) or die "no inboxdir defined\n";
        -d $dir or die "inboxdir=$dir does not exist\n";