* [PATCH 6/6] syscall: modernize away from pre-Perl-5.6 conventions
2020-01-05 23:23 5% [PATCH 0/6] various cleanups around use/require Eric Wong
@ 2020-01-05 23:23 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-01-05 23:23 UTC (permalink / raw)
To: meta
"use vars" was superseded by "our" in Perl 5.6, and we
can "use parent qw(Exporter)" in favor of manipulating
@ISA directly (or the bigger "use base ...");
While we're at it, avoid multiple invocations of constant->import
by passing a hashref as a "use" parameter.
---
lib/PublicInbox/Syscall.pm | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 487013d5..c66ea51b 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -13,42 +13,39 @@
# License or the Artistic License, as specified in the Perl README file.
package PublicInbox::Syscall;
use strict;
+use parent qw(Exporter);
use POSIX qw(ENOSYS SEEK_CUR);
use Config;
-require Exporter;
-use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS $VERSION);
-
-$VERSION = "0.25";
-@ISA = qw(Exporter);
-@EXPORT_OK = qw(epoll_ctl epoll_create epoll_wait
+# $VERSION = '0.25'; # Sys::Syscall version
+our @EXPORT_OK = qw(epoll_ctl epoll_create epoll_wait
EPOLLIN EPOLLOUT EPOLLET
EPOLL_CTL_ADD EPOLL_CTL_DEL EPOLL_CTL_MOD
EPOLLONESHOT EPOLLEXCLUSIVE
signalfd SFD_NONBLOCK);
-%EXPORT_TAGS = (epoll => [qw(epoll_ctl epoll_create epoll_wait
+our %EXPORT_TAGS = (epoll => [qw(epoll_ctl epoll_create epoll_wait
EPOLLIN EPOLLOUT
EPOLL_CTL_ADD EPOLL_CTL_DEL EPOLL_CTL_MOD
EPOLLONESHOT EPOLLEXCLUSIVE)],
);
-use constant EPOLLIN => 1;
-use constant EPOLLOUT => 4;
-# use constant EPOLLERR => 8;
-# use constant EPOLLHUP => 16;
-# use constant EPOLLRDBAND => 128;
-use constant EPOLLEXCLUSIVE => (1 << 28);
-use constant EPOLLONESHOT => (1 << 30);
-use constant EPOLLET => (1 << 31);
-use constant EPOLL_CTL_ADD => 1;
-use constant EPOLL_CTL_DEL => 2;
-use constant EPOLL_CTL_MOD => 3;
use constant {
+ EPOLLIN => 1,
+ EPOLLOUT => 4,
+ # EPOLLERR => 8,
+ # EPOLLHUP => 16,
+ # EPOLLRDBAND => 128,
+ EPOLLEXCLUSIVE => (1 << 28),
+ EPOLLONESHOT => (1 << 30),
+ EPOLLET => (1 << 31),
+ EPOLL_CTL_ADD => 1,
+ EPOLL_CTL_DEL => 2,
+ EPOLL_CTL_MOD => 3,
+
SFD_CLOEXEC => 02000000,
SFD_NONBLOCK => 00004000,
};
-
our $loaded_syscall = 0;
sub _load_syscall {
^ permalink raw reply related [relevance 7%]
* [PATCH 0/6] various cleanups around use/require
@ 2020-01-05 23:23 5% Eric Wong
2020-01-05 23:23 7% ` [PATCH 6/6] syscall: modernize away from pre-Perl-5.6 conventions Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-01-05 23:23 UTC (permalink / raw)
To: meta
We've accumulated some cruft over the years. Lets get rid of
some of it and find places where we can help Perl figure more
stuff out at compile-time rather than run-time.
Eric Wong (6):
hval: export prurl and add prototype
view: update POSIX::strftime usage
altid: use msgmap at compile time
admin: do not lazy-load Inbox or Config packages
treewide: "require" + "use" cleanup and docs
syscall: modernize away from pre-Perl-5.6 conventions
Makefile.PL | 2 +-
lib/PublicInbox/Admin.pm | 4 ++--
lib/PublicInbox/AltId.pm | 3 +--
lib/PublicInbox/Config.pm | 2 +-
lib/PublicInbox/DS.pm | 5 ++---
lib/PublicInbox/Daemon.pm | 2 +-
lib/PublicInbox/Emergency.pm | 2 +-
lib/PublicInbox/ExtMsg.pm | 5 ++---
lib/PublicInbox/Filter/RubyLang.pm | 1 -
lib/PublicInbox/Git.pm | 2 +-
lib/PublicInbox/GitHTTPBackend.pm | 2 +-
lib/PublicInbox/HTTP.pm | 3 ++-
lib/PublicInbox/HTTPD.pm | 4 ++--
lib/PublicInbox/Hval.pm | 5 +++--
lib/PublicInbox/Import.pm | 2 +-
lib/PublicInbox/Listener.pm | 2 +-
lib/PublicInbox/MboxGz.pm | 1 -
lib/PublicInbox/NNTPD.pm | 2 +-
lib/PublicInbox/NewsWWW.pm | 3 ++-
lib/PublicInbox/Search.pm | 2 --
lib/PublicInbox/SearchIdx.pm | 2 +-
lib/PublicInbox/SearchView.pm | 6 +----
lib/PublicInbox/SolverGit.pm | 2 +-
lib/PublicInbox/Spawn.pm | 1 -
lib/PublicInbox/Syscall.pm | 35 ++++++++++++++----------------
lib/PublicInbox/TLS.pm | 2 --
lib/PublicInbox/Tmpfile.pm | 2 +-
lib/PublicInbox/V2Writable.pm | 2 +-
lib/PublicInbox/View.pm | 17 +++++++--------
lib/PublicInbox/ViewDiff.pm | 2 +-
lib/PublicInbox/WatchMaildir.pm | 2 +-
lib/PublicInbox/WwwAtomStream.pm | 2 +-
lib/PublicInbox/WwwListing.pm | 6 ++---
lib/PublicInbox/WwwStream.pm | 4 ++--
lib/PublicInbox/Xapcmd.pm | 2 +-
script/public-inbox-convert | 2 --
script/public-inbox-edit | 8 +++----
script/public-inbox-init | 4 ++--
script/public-inbox-nntpd | 4 ++--
t/cgi.t | 2 --
t/feed.t | 2 --
41 files changed, 71 insertions(+), 92 deletions(-)
^ permalink raw reply [relevance 5%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-01-05 23:23 5% [PATCH 0/6] various cleanups around use/require Eric Wong
2020-01-05 23:23 7% ` [PATCH 6/6] syscall: modernize away from pre-Perl-5.6 conventions 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).