in reply to Re: filehandle/socket question (seek)
in thread filehandle/socket question

the problem is that the reading and writing happen in separate threads, hence making "between calls" a very obscure concept in this context :-) situations might occur where reads and writes actually happen at the very same moment, in fact, it probably happens all the time the way the script is set up. It *seems* to be working fine though, but since all the docs advised against I thought I'd better go and ask if there's a more proper approach.
  • Comment on Re^2: filehandle/socket question (seek)

Replies are listed 'Best First'.
Re^3: filehandle/socket question (dup)
by tye (Sage) on Jul 18, 2004 at 17:51 UTC

    In that case, dup(2)ing the file handle is probably a better idea:

    open IN, "<&SOCKET" or die ...;

    though selecting a suitable non-bareword file handle scheme is even better.

    my $in = ...; open $in, "<&".fileno($sock) or die ...;

    Where the first "..." depends on what you find appropriate. "undef" works for modern versions of Perl. Or you can use IO::Handle or other module or just do { local(*IN); \*IN }.

    - tye