From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BB3E61F881 for ; Sun, 5 Jan 2020 23:23:37 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/6] syscall: modernize away from pre-Perl-5.6 conventions Date: Sun, 5 Jan 2020 23:23:36 +0000 Message-Id: <20200105232336.26023-7-e@yhbt.net> In-Reply-To: <20200105232336.26023-1-e@yhbt.net> References: <20200105232336.26023-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: "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 {