"Shane Anderson" <[EMAIL PROTECTED]> wrote on 12/10/2007 09:45:02 AM:
> Hi,
>
> I've removed the if statement that checks the hash so now the code
> looks like this:
> while (my ($client, $client_address) = $server->accept()) {
> $client->autoflush(1);
> my ($port, $packed_ip) = sockaddr_in($client_address);
> my $client_ip = inet_ntoa($packed_ip);
> my $stamp = ×tamp;
> print LOGFILE "$stamp - Client ($client_ip) connected.\n" if $DEBUG
== 1;
> $client->recv($recv, 128);
>
> #if (exists($commands{$recv})) {
> # $client->send("Works!");
> # } else {
> chomp($recv);
> $client->send("Doesn't work! - $recv - The command should
> appear before this.");
> # }
> }
It could be chomp is removing the newline, but not carriage return(?).
Try instead of chomp this:
$recv =~ s/\r\n//;
or it may be ordered the other way, I can't remember:
$recv =~ s/\n\r//;
Regards,
Scott
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html