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-Status: No, score=-3.9 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 14FD71FB06 for ; Sun, 7 Feb 2021 08:52:02 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 06/19] ipc: trim down the Storable checks Date: Sun, 7 Feb 2021 08:51:48 +0000 Message-Id: <20210207085201.13871-7-e@80x24.org> In-Reply-To: <20210207085201.13871-1-e@80x24.org> References: <20210207085201.13871-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's distributed with Perl and our Makefile.PL even declares a dependency on it, just like Encode and all the Compress::* stuff. --- lib/PublicInbox/IPC.pm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index 8f6f4ded..3713b56b 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -38,12 +38,9 @@ if ($enc && $dec) { # should be custom ops *ipc_freeze = sub ($) { sereal_encode_with_object $enc, $_[0] }; *ipc_thaw = sub ($) { sereal_decode_with_object $dec, $_[0], my $ret }; } else { - eval { # some distros have Storable as a separate package from Perl - require Storable; - *ipc_freeze = \&Storable::freeze; - *ipc_thaw = \&Storable::thaw; - $enc = 1; - } // warn("Storable (part of Perl) missing: $@\n"); + require Storable; + *ipc_freeze = \&Storable::freeze; + *ipc_thaw = \&Storable::thaw; } my $recv_cmd = PublicInbox::Spawn->can('recv_cmd4'); @@ -102,7 +99,6 @@ sub ipc_worker_loop ($$$) { # starts a worker if Sereal or Storable is installed sub ipc_worker_spawn { my ($self, $ident, $oldset, $fields) = @_; - return unless $enc; # no Sereal or Storable return if ($self->{-ipc_ppid} // -1) == $$; # idempotent delete(@$self{qw(-ipc_req -ipc_res -ipc_ppid -ipc_pid)}); pipe(my ($r_req, $w_req)) or die "pipe: $!"; @@ -364,7 +360,7 @@ sub _wq_worker_start ($$$) { # starts workqueue workers if Sereal or Storable is installed sub wq_workers_start { my ($self, $ident, $nr_workers, $oldset, $fields) = @_; - ($enc && $send_cmd && $recv_cmd && defined($SEQPACKET)) or return; + ($send_cmd && $recv_cmd && defined($SEQPACKET)) or return; return if $self->{-wq_s1}; # idempotent $self->{-wq_s1} = $self->{-wq_s2} = undef; socketpair($self->{-wq_s1}, $self->{-wq_s2}, AF_UNIX, $SEQPACKET, 0) or