Re: Generating EOF character on Win98
by nysus (Parson) on Jul 23, 2001 at 22:30 UTC
|
| [reply] |
|
|
| [reply] |
Re: Generating EOF character on Win98
by virtualsue (Vicar) on Jul 23, 2001 at 21:46 UTC
|
I have a Win98 system running Perl v5.6 that I booted up
especially for you. :) Your code works fine, if, as I suggested
in the Chatterbox, you add a newline to your last print
statement (i.e. print "hello\n"). STDOUT
isn't getting flushed on exit.
| [reply] [d/l] |
|
|
| [reply] |
|
|
It works for me even without the final newline.
Another interesting point is that nysus mentioned that
pressing CTRL-Z causes the program to terminate immediately
where my experience (and current testing) shows that you
have to press ENTER after the CTRL-Z for the EOF to be
noticed by the program.
I'm not sure where to look next but I'd probably look at
the "DOS properties" of the window that the script is
running in. Perhaps the CTRL-Z key sequence has been
found to some other function? (Though I can't see how even
that would explain the stated behavior.)
-
tye
(but my friends call me "Tye")
| [reply] |
|
|
Oh brother. Now I know why I feel a need to keep a crucifix
handy when I work on a PC. On my setup it works the first
time I run it (defined as printing 'hello' after ^Z is
pressed). Forever after that (well, several times, until I
get bored) the 'hello' is not displayed. I have to reboot
the PC in order to see 'hello' again. Très weird.
I have only investigated far enough to note that, as you
say, the
newline doesn't appear to figure in this at all. It works
the first time, and then not again until I restart. Killing
the MS-DOS window and starting another one doesn't help.
| [reply] |
|
|
You don't need a final newline under Win32, either to make it flush or to prevent the prompt from overwriting your line.
| [reply] |
Re: Generating EOF character on Win98
by Anonymous Monk on Jul 23, 2001 at 22:24 UTC
|
Well, I get the same thing happening to me whenever I run any scripts on Windows. What do you mean by "terminates"?
If you mean that the program exits and returns you to the C:\ prompt (or wherever) then I have no idea.
However, what always happened to me is that the DOS window I was running the thing in would simply vanish. If this is the problem, do not run the perl script by double-clicking on the icon. In my case would run fine, but when the last bit of output is reached (In this case, your "hello") it would print it and then IMMEDIATELY kill the window.
The solution was to open the DOS window first (Start --> Programs --> MS-DOS Prompt if my memory is holding out) and then run your script using perl "location" where "location" is the path to your script.
It's also worth noting that if Perl isn't in your PATH, that won't work unless you're in your Perl directory. | [reply] |
|
|
It's also worth noting that if Perl isn't in your PATH, that won't work unless you're in your Perl directory
It works if you have an alias set up, so Perl expands into the fully-qualified name.
It works if your shell looks in the "App Paths" registry settings.
| [reply] |
Re: Generating EOF character on Win98
by John M. Dlugosz (Monsignor) on Jul 24, 2001 at 01:19 UTC
|
Did you hit Enter after the print line, and then press ^Z? IME, it only works at the beginning of a line. Something to do with the way the shell buffers it, I guess. | [reply] |