singer@ibm.com (David Singer) (02/17/91)
I just got The Book and a copy of Perl and typed in the "tlist" script on page 21. It hung. After a lot of head-scratching, I finally discovered that I had a named pipe in my home directory, and that the -T test was waiting for someone to write into the pipe. It seems that -T and -B should return "false" on a named pipe without trying to read it. -- David Singer -- Internet: singer@ibm.com BITNET: SINGER at ALMADEN Voice: (408) 927-2509 Fax: (408) 927-4073 (amusing disclaimer du jour goes here)
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/19/91)
In article <521@rufus.UUCP> singer@ibm.com (David Singer) writes:
: It seems that -T and -B should return "false" on a named pipe without
: trying to read it.
That would be fascist. What if you want to use -T or -B to find out whether
a pipe is returning text or binary data?
Better would be to hide the -T/B behind a !-p, in my hubristic opinion.
Larry
singer@ibm.com (David Singer) (02/19/91)
In article <11483@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: > >That would be fascist. What if you want to use -T or -B to find out whether >a pipe is returning text or binary data? Is it possible for the nature of the data being returned to change from text to binary and back again? And wouldn't reading data from the pipe consume it (or is it possible to reread the first part)? > >Better would be to hide the -T/B behind a !-p, in my hubristic opinion. After I figured out what was hanging up the script, I did modify it to skip pipes (hey, it was only the second perl program I'd typed in!). I was just surprised to have an example from the book act so strangely. I freely admit I'm a Perl novice and pretty much a rookie at Unix in general. -- David Singer -- Internet: singer@ibm.com BITNET: SINGER at ALMADEN Voice: (408) 927-2509 Fax: (408) 927-4073 (amusing disclaimer du jour goes here)
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/19/91)
In article <527@rufus.UUCP> singer@ibm.com (David Singer) writes: : In article <11483@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: : > : >That would be fascist. What if you want to use -T or -B to find out whether : >a pipe is returning text or binary data? : : Is it possible for the nature of the data being returned to change from text : to binary and back again? And wouldn't reading data from the pipe consume : it (or is it possible to reread the first part)? Yes. Yes (no). : >Better would be to hide the -T/B behind a !-p, in my hubristic opinion. : : After I figured out what was hanging up the script, I did modify it to skip : pipes (hey, it was only the second perl program I'd typed in!). I was just : surprised to have an example from the book act so strangely. I suspect that FIFOs should ordinarily be banned from ordinary directories. Perl is not the only program that will have such difficulties. : I freely admit I'm a Perl novice and pretty much a rookie at Unix in general. I freely admit to coming from a non-FIFO culture. Larry
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (02/20/91)
In article <11485@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: > I suspect that FIFOs should ordinarily be banned from ordinary directories. > Perl is not the only program that will have such difficulties. There aren't many programs that try to intuit what a file is from its contents unless they plan to make some use of those contents. The ``file'' program is a counterexample, and at least Sun's ``file'' detects and reports fifos properly. I assume the same is true under straight System V. What other programs are you thinking of? ---Dan
tneff@bfmny0.BFM.COM (Tom Neff) (02/21/91)
In article <11485@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >I freely admit to coming from a non-FIFO culture. Yeah, but LIFO's a bitch, and then you pop. :-) -- The most common given name in the world is Mohammad; | Tom Neff the most common family name in the world is Chang. | Can you imagine the enormous number of people in the | tneff@bfmny0.BFM.COM world named Mohammad Chang? -- Derek Wills | uunet!bfmny0!tneff