From: Eric Wong <e@80x24.org> To: meta@public-inbox.org Subject: [PATCH 03/11] use "\&" where possible when referring to subroutines Date: Wed, 9 Sep 2020 06:26:10 +0000 Message-ID: <20200909062618.5940-4-e@80x24.org> (raw) In-Reply-To: <20200909062618.5940-1-e@80x24.org> "*foo" is ambiguous in that it may refer to a bareword file handle; so we'll use it where we can without triggering warnings. PublicInbox::TestCommon::run_script_exit required dropping the prototype, however. We'll also future-proof by dropping "use warnings" in Cgit.pm and use the less-ambiguous "//=" in Inbox.pm while we're in the area. --- lib/PublicInbox/Cgit.pm | 5 ++--- lib/PublicInbox/Inbox.pm | 2 +- lib/PublicInbox/TestCommon.pm | 4 ++-- lib/PublicInbox/WwwListing.pm | 6 +++--- t/replace.t | 8 ++++---- t/solver_git.t | 2 +- xt/msgtime_cmp.t | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm index 9a51b451..fb0d0e60 100644 --- a/lib/PublicInbox/Cgit.pm +++ b/lib/PublicInbox/Cgit.pm @@ -10,9 +10,8 @@ use strict; use PublicInbox::GitHTTPBackend; use PublicInbox::Git; # not bothering with Exporter for a one-off -*input_prepare = *PublicInbox::GitHTTPBackend::input_prepare; -*serve = *PublicInbox::GitHTTPBackend::serve; -use warnings; +*input_prepare = \&PublicInbox::GitHTTPBackend::input_prepare; +*serve = \&PublicInbox::GitHTTPBackend::serve; use PublicInbox::Qspawn; use PublicInbox::WwwStatic qw(r); diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 3b5ac970..b0894a7d 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -70,7 +70,7 @@ sub _cleanup_later ($) { my ($self) = @_; $cleanup_avail = cleanup_possible() if $cleanup_avail < 0; return if $cleanup_avail != 1; - $cleanup_timer ||= PublicInbox::DS::later(*cleanup_task); + $cleanup_timer //= PublicInbox::DS::later(\&cleanup_task); $CLEANUP->{"$self"} = $self; } diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index b03e93e0..42819179 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -158,7 +158,7 @@ sub _undo_redirects ($) { # The default is 2. our $run_script_exit_code; sub RUN_SCRIPT_EXIT () { "RUN_SCRIPT_EXIT\n" }; -sub run_script_exit (;$) { +sub run_script_exit { $run_script_exit_code = $_[0] // 0; die RUN_SCRIPT_EXIT; } @@ -180,7 +180,7 @@ package $pkg; use strict; use subs qw(exit); -*exit = *PublicInbox::TestCommon::run_script_exit; +*exit = \\&PublicInbox::TestCommon::run_script_exit; sub main { # the below "line" directive is a magic comment, see perlsyn(1) manpage # line 1 "$f" diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm index 365743cf..0be3764c 100644 --- a/lib/PublicInbox/WwwListing.pm +++ b/lib/PublicInbox/WwwListing.pm @@ -60,9 +60,9 @@ sub list_404 ($$) { [] } # TODO: +cgit my %VALID = ( - all => *list_all, - 'match=domain' => *list_match_domain, - 404 => *list_404, + all => \&list_all, + 'match=domain' => \&list_match_domain, + 404 => \&list_404, ); sub set_cb ($$$) { diff --git a/t/replace.t b/t/replace.t index a1e2d63b..95241adf 100644 --- a/t/replace.t +++ b/t/replace.t @@ -179,10 +179,10 @@ EOF } } -my $opt = { pre => *pad_msgs }; +my $opt = { pre => \&pad_msgs }; test_replace(2, 'basic', {}); test_replace(2, 'basic', $opt); -test_replace(2, 'basic', $opt = { %$opt, post => *pad_msgs }); +test_replace(2, 'basic', $opt = { %$opt, post => \&pad_msgs }); test_replace(2, 'basic', $opt = { %$opt, rotate_bytes => 1 }); SKIP: { @@ -190,9 +190,9 @@ SKIP: { PublicInbox::Search::load_xapian() or skip 'Search::Xapian missing', 8; for my $l (qw(medium)) { test_replace(2, $l, {}); - $opt = { pre => *pad_msgs }; + $opt = { pre => \&pad_msgs }; test_replace(2, $l, $opt); - test_replace(2, $l, $opt = { %$opt, post => *pad_msgs }); + test_replace(2, $l, $opt = { %$opt, post => \&pad_msgs }); test_replace(2, $l, $opt = { %$opt, rotate_bytes => 1 }); } }; diff --git a/t/solver_git.t b/t/solver_git.t index 78cc0edd..c162b605 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -41,7 +41,7 @@ $ibx->{-repo_objs} = [ $git ]; my $res; my $solver = PublicInbox::SolverGit->new($ibx, sub { $res = $_[0] }); open my $log, '+>>', "$inboxdir/solve.log" or die "open: $!"; -my $psgi_env = { 'psgi.errors' => *STDERR, 'psgi.url_scheme' => 'http', +my $psgi_env = { 'psgi.errors' => \*STDERR, 'psgi.url_scheme' => 'http', 'HTTP_HOST' => 'example.com' }; $solver->solve($psgi_env, $log, '69df7d5', {}); ok($res, 'solved a blob!'); diff --git a/xt/msgtime_cmp.t b/xt/msgtime_cmp.t index 0ce3c042..aa96be4d 100644 --- a/xt/msgtime_cmp.t +++ b/xt/msgtime_cmp.t @@ -62,7 +62,7 @@ my $fh = $git->popen(@cat); while (<$fh>) { my ($oid, $type) = split / /; next if $type ne 'blob'; - $git->cat_async($oid, *compare); + $git->cat_async($oid, \&compare); } $git->cat_async_wait; ok(1);
next prev parent reply other threads:[~2020-09-09 6:26 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-09 6:26 [PATCH 00/11] httpd: further reduce event loop monopolization Eric Wong 2020-09-09 6:26 ` [PATCH 01/11] xt/solver: test with public-inbox-httpd, too Eric Wong 2020-09-09 6:26 ` [PATCH 02/11] solver: drop warnings, modernize use v5.10.1, use SEEK_SET Eric Wong 2020-09-09 6:26 ` Eric Wong [this message] 2020-09-09 6:26 ` [PATCH 04/11] www: manifest.js.gz generation no longer hogs event loop Eric Wong 2020-09-09 6:26 ` [PATCH 05/11] config: flatten each_inbox and iterate_start args Eric Wong 2020-09-09 6:26 ` [PATCH 06/11] config: split out iterator into separate object Eric Wong 2020-09-09 6:26 ` [PATCH 07/11] t/cgi.t: show stderr on failures Eric Wong 2020-09-09 6:26 ` [PATCH 08/11] extmsg: prevent cross-inbox matches from hogging event loop Eric Wong 2020-09-09 6:26 ` [PATCH 09/11] wwwlisting: avoid " Eric Wong 2020-09-09 6:26 ` [PATCH 10/11] solver: check one git coderepo and inbox at a time Eric Wong 2020-09-09 6:26 ` [PATCH 11/11] solver: break apart inbox blob retrieval Eric Wong 2020-09-10 1:51 ` [PATCH 12/11] solver: async blob retrieval for diff extraction Eric Wong
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://public-inbox.org/README * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200909062618.5940-4-e@80x24.org \ --to=e@80x24.org \ --cc=meta@public-inbox.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
user/dev discussion of public-inbox itself This inbox may be cloned and mirrored by anyone: git clone --mirror http://public-inbox.org/meta git clone --mirror http://czquwvybam4bgbro.onion/meta git clone --mirror http://hjrcffqmbrq6wope.onion/meta git clone --mirror http://ou63pmih66umazou.onion/meta # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V1 meta meta/ http://public-inbox.org/meta \ meta@public-inbox.org public-inbox-index meta Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta nntp://news.gmane.io/gmane.mail.public-inbox.general note: .onion URLs require Tor: https://www.torproject.org/ code repositories for the project(s) associated with this inbox: https://80x24.org/public-inbox.git AGPL code for this site: git clone https://public-inbox.org/public-inbox.git