in reply to Cant find out how to get the real file handle name!

To start with:
if ($fh == $lsn) { # this does not do what you think it does
If you want to compare filehandles, use fileno()

Next:
$inbuffer{$fh} .= $buf; # Hash keys are stored as STRINGS. ... foreach $client (keys %ready) { # So, when you are finally here # $client is just a STRING # It is no longer a reference handle($client); }


--perlplexer

Replies are listed 'Best First'.
Re: Re: Cant find out how to get the real file handle name!
by Fletch (Bishop) on Apr 16, 2002 at 18:43 UTC

    If you really need to use references as keys, use the standard Tie::RefHash module which won't stringify them.

      Thanks for answering!

      This seems like what I want to do so thanks!!!

      BTW, do you think there is a better way to maintain the list of incoming sockets?

      Thanks,
      mslattery

      Fletch,

      Thank YOU very much.

      Just adding the Tie::RefHash and of course Tie(ing) the hash did the trick. All works great now!

      Thanks,
      Mike

Re: Re: Cant find out how to get the real file handle name!
by mslattery (Initiate) on Apr 18, 2002 at 14:29 UTC
    First off, thanks for answering...

    The $fh==$lsn works, but that doesnt mean it's correct. I'll look into using fileno() but my understanding is that when you use IO::Socket it doesnt work EXACTLY like filehandles under WIN32 (which is my platform, should of said earlier eh?).

    As for the stored as strings, I know.. that's my problem. I'll look into TIE I guess! :)

    Thanks Again,
    mslattery