Qitan has asked for the wisdom of the Perl Monks concerning the following question:
The line: if ( my $request = <$client> ) is what fails and it jumps down to the 'close $client;' line. My knowledge of Perl is not great but from what I know, <$client> is trying to read a line of data from the socket that was setup. If I print the value of $client I get: IO::Socket::INET=GLOB(0x1b4dfd8) When I try to print the value of <$client> I get no response from the program. I am running WinXP Home sp1, Internet Explorer 6 sp1 and the perl that I'm using is Activestate 5.6.1. Any ideas? Thanks# See if there's a connection waiting on the $server by getting the l +ist of handles with data to # read, if the handle is the server then we're off. Note the +0.1 second delay here when waiting # around. This means that we don't hog the processor while wa +iting for connections. my ($ready) = $selector->can_read(0.1); my ($uiready) = $uiselector->can_read(0.1); # Handle HTTP requests for the UI if ( $uiready == $ui ) { if ( my $client = $ui->accept() ) { # Check that this is a connection from the local machi +ne, if it's not then we drop it immediately # without any further processing. We don't want to al +low remote users to admin my ( $remote_port, $remote_host ) = sockaddr_in( $clie +nt->peername() ); if ( $remote_host eq inet_aton( "127.0.0.1" ) ) { if ( my $request = <$client> ) { debug( $request ); while ( <$client> ) { if ( !/(.*): (.*)/ ) { last; } } if ( $request =~ /GET (.*) HTTP\/1\./ ) { my $url = $1; print $client handle_url($url); } else { print $client http_error(500); } } } close $client;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem reading the value of <$client>
by chromatic (Archbishop) on Dec 02, 2002 at 22:46 UTC | |
by Anonymous Monk on Dec 02, 2002 at 22:56 UTC | |
|
Re: Problem reading the value of <$client>
by traveler (Parson) on Dec 02, 2002 at 23:41 UTC | |
|
Re: Problem reading the value of <$client>
by dingus (Friar) on Dec 03, 2002 at 10:03 UTC |