-=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<sprintf>-style I<format> and
-I<args>.
-
-=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;
-}
-