* [PATCH] remove "no warnings 'once'" in a few places
@ 2019-12-23 23:06 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-12-23 23:06 UTC (permalink / raw)
To: meta
We can use "use" to get the namespace into the "BEGIN" phase of
the interpreter. While we're at it, use \&coderef syntax
explicitly instead of globbing everything.
---
lib/PublicInbox/Spawn.pm | 3 +--
lib/PublicInbox/WwwListing.pm | 3 ++-
script/public-inbox-purge | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm
index 6493ad38..c64812dd 100644
--- a/lib/PublicInbox/Spawn.pm
+++ b/lib/PublicInbox/Spawn.pm
@@ -172,8 +172,7 @@ if (defined $vfork_spawn) {
unless (defined $vfork_spawn) {
require PublicInbox::SpawnPP;
- no warnings 'once';
- *pi_fork_exec = *PublicInbox::SpawnPP::pi_fork_exec
+ *pi_fork_exec = \&PublicInbox::SpawnPP::pi_fork_exec
}
sub which ($) {
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index 03534f03..bcb968af 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -9,11 +9,12 @@ use warnings;
use PublicInbox::Hval qw(ascii_html);
use PublicInbox::Linkify;
use PublicInbox::View;
+use PublicInbox::Inbox;
use bytes ();
use HTTP::Date qw(time2str);
require Digest::SHA;
require File::Spec;
-{ no warnings 'once'; *try_cat = *PublicInbox::Inbox::try_cat };
+*try_cat = \&PublicInbox::Inbox::try_cat;
sub list_all ($$$) {
my ($self, $env, $hide_key) = @_;
diff --git a/script/public-inbox-purge b/script/public-inbox-purge
index 0705d170..f103ccf7 100755
--- a/script/public-inbox-purge
+++ b/script/public-inbox-purge
@@ -9,11 +9,11 @@ use warnings;
use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
use PublicInbox::AdminEdit;
PublicInbox::Admin::check_require('-index');
-require PublicInbox::Filter::Base;
-require PublicInbox::MIME;
+use PublicInbox::Filter::Base;
+use PublicInbox::MIME;
require PublicInbox::V2Writable;
-{ no warnings 'once'; *REJECT = *PublicInbox::Filter::Base::REJECT }
+*REJECT = \&PublicInbox::Filter::Base::REJECT;
my $usage = "$0 [--all] [INBOX_DIRS] </path/to/message";
my $opt = { verbose => 1, all => 0, -min_inbox_version => 2 };
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2019-12-23 23:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23 23:06 [PATCH] remove "no warnings 'once'" in a few places Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).