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.0 required=3.0 tests=ALL_TRUSTED,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 32A011F4B7 for ; Mon, 24 Jun 2019 02:52:59 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 02/57] ds: get rid of more unused debug instance methods Date: Mon, 24 Jun 2019 02:52:03 +0000 Message-Id: <20190624025258.25592-3-e@80x24.org> In-Reply-To: <20190624025258.25592-1-e@80x24.org> References: <20190624025258.25592-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Over a decade of using Danga::Socket and I never found the built-in debug functionality useful. --- lib/PublicInbox/DS.pm | 69 ------------------------------------------- 1 file changed, 69 deletions(-) diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index f4fe8793..9e24ed78 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -34,8 +34,6 @@ use fields ('sock', # underlying socket use Errno qw(EAGAIN EINVAL); use Carp qw(croak confess); -use constant DebugLevel => 0; - use constant POLLIN => 1; use constant POLLOUT => 4; use constant POLLERR => 8; @@ -105,18 +103,6 @@ sub SetLoopTimeout { return $LoopTimeout = $_[1] + 0; } -=head2 C<< CLASS->DebugMsg( $format, @args ) >> - -Print the debugging message specified by the C-style I and -I - -=cut -sub DebugMsg { - my ( $class, $fmt, @args ) = @_; - chomp $fmt; - printf STDERR ">>> $fmt\n", @args; -} - =head2 C<< CLASS->AddTimer( $seconds, $coderef ) >> Add a timer to occur $seconds from now. $seconds may be fractional, but timers @@ -487,16 +473,6 @@ sub close { return 0; } -=head2 C<< $obj->sock() >> - -Returns the underlying IO::Handle for the object. - -=cut -sub sock { - my PublicInbox::DS $self = shift; - return $self->{sock}; -} - =head2 C<< $obj->write( $data ) >> Write the specified data to the underlying handle. I may be scalar, @@ -671,51 +647,6 @@ sub watch_write { } } -=head2 C<< $obj->dump_error( $message ) >> - -Prints to STDERR a backtrace with information about this socket and what lead -up to the dump_error call. - -=cut -sub dump_error { - my $i = 0; - my @list; - while (my ($file, $line, $sub) = (caller($i++))[1..3]) { - push @list, "\t$file:$line called $sub\n"; - } - - warn "ERROR: $_[1]\n" . - "\t$_[0] = " . $_[0]->as_string . "\n" . - join('', @list); -} - -=head2 C<< $obj->debugmsg( $format, @args ) >> - -Print the debugging message specified by the C-style I and -I. - -=cut -sub debugmsg { - my ( $self, $fmt, @args ) = @_; - confess "Not an object" unless ref $self; - - chomp $fmt; - printf STDERR ">>> $fmt\n", @args; -} - -=head2 C<< $obj->as_string() >> - -Returns a string describing this socket. - -=cut -sub as_string { - my PublicInbox::DS $self = shift; - my $rw = "(" . ($self->{event_watch} & POLLIN ? 'R' : '') . - ($self->{event_watch} & POLLOUT ? 'W' : '') . ")"; - my $ret = ref($self) . "$rw: " . ($self->{sock} ? 'open' : 'closed'); - return $ret; -} - package PublicInbox::DS::Timer; # [$abs_float_firetime, $coderef]; sub cancel { -- EW