--- branches/CPAN/lib/WAIT/Client.pm 2000/04/28 15:41:10 11 +++ branches/CPAN/lib/WAIT/Client.pm 2000/04/28 15:42:44 13 @@ -1,5 +1,5 @@ -# -*- Mode: Perl -*- -# Client.pm -- +# -*- Mode: Cperl -*- +# Client.pm -- # ITIID : $ITI$ $Header $__Header$ # Author : Ulrich Pfeifer # Created On : Fri Jan 31 10:49:37 1997 @@ -8,9 +8,9 @@ # Language : CPerl # Update Count : 85 # Status : Unknown, Use with caution! -# +# # (C) Copyright 1997, Universität Dortmund, all rights reserved. -# +# package WAIT::Client; use Net::NNTP (); @@ -24,7 +24,7 @@ sub search { my $wait = shift; - + $wait->_SEARCH(@_) ? $wait->read_until_dot() : undef; @@ -34,7 +34,7 @@ { @_ == 2 or croak 'usage: $wait->info( HIT-NUMBER )'; my $wait = shift; - + $wait->_INFO(@_) ? $wait->read_until_dot() : undef; @@ -44,7 +44,7 @@ { @_ == 2 or croak 'usage: $wait->info( HIT-NUMBER )'; my $wait = shift; - + $wait->_GET(@_) ? $wait->read_until_dot() : undef; @@ -54,7 +54,7 @@ { @_ == 2 or croak 'usage: $wait->database( DBNAME )'; my $wait = shift; - + $wait->_DATABASE(@_); } @@ -62,7 +62,7 @@ { @_ == 2 or croak 'usage: $wait->table( TABLE )'; my $wait = shift; - + $wait->_TABLE(@_); } @@ -70,7 +70,7 @@ { @_ == 2 or croak 'usage: $wait->hits( NUM-MAX-HITS )'; my $wait = shift; - + $wait->_HITS(@_); } @@ -96,7 +96,7 @@ my %parm = @_; my ($proxy, $port) = ($parm{Proxy} =~ m{^(?:http://)(\S+)(?::(\d+))}); $port = 80 unless $port; - + my $self = { proxy_host => $proxy, proxy_port => $port, @@ -104,7 +104,7 @@ wais_port => $parm{Port}, }; bless $self, $type; - + if ($self->command('HELP')->response == CMD_INFO) { return $self; } else { @@ -123,17 +123,17 @@ ); return unless $con; my $cmd = join ' ', @_; - + if ($self->{hits}) { $cmd = "HITS $self->{hits}:$cmd"; } $cmd = "Command: $cmd"; $con->autoflush(1); - + $con->printf("POST http://$self->{wais_host}:$self->{wais_port} ". "HTTP/1.0\nContent-Length: %d\n\n$cmd", length($cmd)); - + unless ($con->response == CMD_OK) { warn "No greeting from server\n"; } @@ -153,11 +153,11 @@ sub search { my $wait = shift; - + if ($wait->_SEARCH(@_)) { my $r = $wait->read_until_dot(); my $i = 1; - + delete $wait->{'map'}; for (@$r) { if (s/^(\d+)/sprintf("%4d",$i)/e) {