From 55b707d788ce13696e4411389583e720ea6dab01 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 5 Jan 2020 23:23:35 +0000 Subject: treewide: "require" + "use" cleanup and docs There's a bunch of leftover "require" and "use" statements we no longer need and can get rid of, along with some excessive imports via "use". IO::Handle usage isn't always obvious, so add comments describing why a package loads it. Along the same lines, document the tmpdir support as the reason we depend on File::Temp 0.19, even though every Perl 5.10.1+ user has it. While we're at it, favor "use" over "require", since it it gives us extra compile-time checking. --- script/public-inbox-convert | 2 -- script/public-inbox-edit | 8 ++++---- script/public-inbox-init | 4 ++-- script/public-inbox-nntpd | 4 ++-- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'script') diff --git a/script/public-inbox-convert b/script/public-inbox-convert index 9bee5e7a..633c4cf8 100755 --- a/script/public-inbox-convert +++ b/script/public-inbox-convert @@ -4,11 +4,9 @@ use strict; use warnings; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); -use PublicInbox::MIME; use PublicInbox::InboxWritable; use PublicInbox::Config; use PublicInbox::V2Writable; -use PublicInbox::Import; use PublicInbox::Spawn qw(spawn); use Cwd 'abs_path'; use File::Copy 'cp'; # preserves permissions: diff --git a/script/public-inbox-edit b/script/public-inbox-edit index 2a9f0531..e408c7bc 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -8,13 +8,13 @@ use strict; use warnings; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); use PublicInbox::AdminEdit; -use File::Temp 0.19 (); +use File::Temp 0.19 (); # 0.19 for TMPDIR use PublicInbox::ContentId qw(content_id); use PublicInbox::MID qw(mid_clean mids); PublicInbox::Admin::check_require('-index'); -require PublicInbox::MIME; -require PublicInbox::InboxWritable; -require PublicInbox::Import; +use PublicInbox::MIME; +use PublicInbox::InboxWritable; +use PublicInbox::Import; my $usage = "$0 -m MESSAGE_ID [--all] [INBOX_DIRS]"; my $opt = { verbose => 1, all => 0, -min_inbox_version => 2, raw => 0 }; diff --git a/script/public-inbox-init b/script/public-inbox-init index da683657..34c93b47 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -14,8 +14,8 @@ EOF use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/; use PublicInbox::Admin; PublicInbox::Admin::require_or_die('-base'); -require PublicInbox::Config; -require PublicInbox::InboxWritable; +use PublicInbox::Config; +use PublicInbox::InboxWritable; use File::Temp qw/tempfile/; use PublicInbox::Lock; use File::Basename qw/dirname/; diff --git a/script/public-inbox-nntpd b/script/public-inbox-nntpd index 3c4be191..27c33f04 100755 --- a/script/public-inbox-nntpd +++ b/script/public-inbox-nntpd @@ -5,9 +5,9 @@ # Standalone NNTP server for public-inbox. use strict; use warnings; -require PublicInbox::Daemon; +use PublicInbox::Daemon; use PublicInbox::NNTP; # need to call import -require PublicInbox::NNTPD; +use PublicInbox::NNTPD; my $nntpd = PublicInbox::NNTPD->new; PublicInbox::Daemon::run('0.0.0.0:119', sub { $nntpd->refresh_groups }, # refresh -- cgit v1.2.3-24-ge0c7