I'm working on this perl script and its a chat server. When I run it I
get perl debugger info from line 55 "Use of uninitialized value in
concantenation (.) or string at telchat.pl line 50.". Anyone have any
ideas what this could be from?
#!/usr/bin/perl -w
use IO::Socket;
use IO::Select;
use strict;
my $port = 12;
my $debugging = 1;
my $serversock = IO::Socket::INET->new(LocalPort => $port,
Type => SOCK_STREAM,
Reuse => 1,
Listen => SOMAXCONN)
or die "Couldn't create server on $port: $!";
my $selectobj = IO::Select->new;
$selectobj->add($serversock);
while(1) {
my @ready = $selectobj->can_read(15);
my $userinput;
foreach my $handle (@ready) {
if($handle == $serversock) {
my $client = $serversock->accept;
$selectobj->add($client);
if($debugging) {
my $hersockaddr = getpeername($client);
my ($port, $iaddr) = sockaddr_in($hersockaddr);
my $herhostname = gethostbyaddr($iaddr, AF_INET);
my $herstraddr = inet_ntoa($iaddr);
print "Remote client connection accepted from: $herhostname
$herstraddr:$port\n";
}
} else {
$userinput = <$handle>;
}
my @ready2 = $selectobj->can_write(15);
foreach (@ready2){
print $_ "$userinput\n";
}
}
}
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs