From: Eric Wong Date: Mon, 24 Jun 2019 02:52:03 +0000 (+0000) Subject: ds: get rid of more unused debug instance methods X-Git-Tag: v1.2.0~156^2~57 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=8c619bae62a3d468505716d58d3559278883eee7;p=public-inbox.git ds: get rid of more unused debug instance methods Over a decade of using Danga::Socket and I never found the built-in debug functionality useful. --- 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 {