Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!roundup.crhc.uiuc.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.lang.perl Subject: Re: While learning PERL... a suggestion Keywords: perl file learn suggest Message-ID: <1991Jan21.092204.11944@ux1.cso.uiuc.edu> Date: 21 Jan 91 09:22:04 GMT References: <1991Jan19.003519.23569@ux1.cso.uiuc.edu> <11115@jpl-devvax.JPL.NASA.GOV> <118879@uunet.UU.NET> Organization: University of Illinois at Urbana Lines: 48 rbj@uunet.UU.NET (Root Boy Jim) writes: >>There's one other possibility. If you know the pipe is really a socket, >>you might be able to do a recv() with the MSG_PEEK flag and read it out >>non-destructively. Likewise for streams, using I_PEEK. >If it wasn't so trivial to write a getchar/ungetchar pair >might ask Larry to hack in ungetc, possibly with no limit on pushback. It would have to push back into the unix file descriptor so that a forked process like uncompress could read it. >Which brings us to the question of what should go in perl? >An easier question might be "What's missing, compared to C?" I don't see why perl has to have EVERYTHING that is in C. >However, it is control over signals that I find most lacking. >It is unclear whether signals are reset upon being being caught >and whether it is blocked during signal handler execution. I >believe Larry deliberately avoided answering these questions >in order to avoid system dependencies. Though I am just at the learning stage of this, one of the things I would like to do in perl is to do totally unblocked i/o using select(). An example of a trivially described program that could demo what I need is a program that take a number of hostnames as arguments, looks up the IP address, each in parallel, opens a socket to connect to the given hosts telnet port, and report which host said "login:" first. Delays in ANY step along the way for ANY host should have NO affect on any others. None of the steps should let the process block. Juggling this in C is tough enough. Maybe not so trivial. BTW, something I cannot see yet how to do, though I have not quite yet gotten time to experiment and try things, is how to keep and manage an array of filehandles. The man page does not show any examples or give any idea, so I will guess and try some things such as putting a subscript on the filehandle itself (kinda doubt it) and just assigning the string that identifies the filehandle into a scalar variable and use that scalar wherever the filehandle is needed (appears to introduce ambiguities in the syntax). -- --Phil Howard, KA9WGN-- | Individual CHOICE is fundamental to a free society | no matter what the particular issue is all about.