I have a program that I am trying to get working on my system. The program uses a GUI that is accessed thru http://localhost:8080. I cannot get my browser to connect to that address. I've done some rudimentary debugging using print statements to see where in the prog things go awry. Here is a snippet of the program where things go wrong.
# 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;
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

In reply to Problem reading the value of <$client> by Qitan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.