From 94096cab6cd5e00c8a36a4a2667bdb9acf43d01f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 27 Jun 2020 10:03:38 +0000 Subject: ds: remove fields.pm usage Since the removal of pseudo-hash support in Perl 5.10, the "fields" module no longer provides the space or speed benefits it did in 5.8. It also does not allow for compile-time checks, only run-time checks. To me, the extra developer overhead in maintaining "use fields" args has become a hassle. None of our non-DS-related code uses fields.pm, nor do any of our current dependencies. In fact, Danga::Socket (which DS was originally forked from) and its subclasses are the only fields.pm users I've ever encountered in the wild. Removing fields may make our code more approachable to other Perl hackers. So stop using fields.pm and locked hashes, but continue to document what fields do for non-trivial classes. --- lib/PublicInbox/Listener.pm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/Listener.pm') diff --git a/lib/PublicInbox/Listener.pm b/lib/PublicInbox/Listener.pm index eb7dd8d4..2e0fc248 100644 --- a/lib/PublicInbox/Listener.pm +++ b/lib/PublicInbox/Listener.pm @@ -4,10 +4,8 @@ # Used by -nntpd for listen sockets package PublicInbox::Listener; use strict; -use warnings; -use base 'PublicInbox::DS'; +use parent 'PublicInbox::DS'; use Socket qw(SOL_SOCKET SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); -use fields qw(post_accept); use IO::Handle; use PublicInbox::Syscall qw(EPOLLIN EPOLLEXCLUSIVE EPOLLET); use Errno qw(EAGAIN ECONNABORTED EPERM); @@ -23,10 +21,8 @@ sub new ($$$) { setsockopt($s, SOL_SOCKET, SO_KEEPALIVE, 1); setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1); # ignore errors on non-TCP listen($s, 1024); - my $self = fields::new($class); + my $self = bless { post_accept => $cb }, $class; $self->SUPER::new($s, EPOLLIN|EPOLLET|EPOLLEXCLUSIVE); - $self->{post_accept} = $cb; - $self } sub event_step { -- cgit v1.2.3-24-ge0c7