Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: STDOUT & STDERR from a dumped perl script Message-ID: <7274@jpl-devvax.JPL.NASA.GOV> Date: 5 Mar 90 22:57:07 GMT References: <1648@sparko.gwu.edu> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 44 In article <1648@sparko.gwu.edu> kelso@seas.gwu.edu (John Kelso) writes: : I've been trying, without any luck, to get a dumped (and then undumped) : perl script to read and write from standard input and standard output. : It can do I/O to regular files without any problems. : : If it can be done, could someone give me an example, or a RTFM : pointer, or even an informative flame? I snooped around and found the same behavior on my Suns (but not on my Vax). Apparently, there's something in the startup code that gets confused when trying to init the stdio structure the second time through. Anyway, the _flag byte is ending up 0, on Suns at least. Maybe they're using XOR to install the bits, so the second time through it clears them? Anyway, here is an unofficial patch. It's unofficial because I don't know who needs it and who doesn't, and who it will blow out of the water. Also, it might be something that undump should fix. I dunno. *** perly.c.orig Mon Mar 5 14:43:20 1990 --- perly.c Mon Mar 5 14:44:02 1990 *************** *** 74,79 **** --- 74,82 ---- if (do_undump) { do_undump = 0; loop_ptr = -1; /* start label stack again */ + stdin->_flag |= _IOREAD; + stdout->_flag |= _IOWRT; + stderr->_flag |= _IOWRT; goto just_doit; } (void)sprintf(index(rcsid,'#'), "%d\n", PATCHLEVEL); See if that makes it feel any better. If anyone else wants to try it, here's a test program. #!/usr/bin/perl -u $foo=; print STDOUT $foo; If the undumped version is a no-op, you have the problem. Larry