cisie_son wrote on Thu Nov 17 18:40:58 CET 2005:
Hi! I'm new to eclipse and encountering a strange phenomenon: I'm using Eclipse 3.1.1 with EPIC 0.3.0, Active Perl 184.108.40.2063 on Windows XP. When I run a perl-script within eclipse (via Run -> Perl Local, without CL-parameters), the commands (or lines of code?) are executed in the wrong order. As an example some simple lines of code: print "\nPlease enter string:\n"; $string =
; print "$string\n"; The output in the perl-console doesnt't print the text at first, but waits for the . After entering a string, the first print-command is displayed, and in the next line the entered string: string-text Please enter string: string-text If I start the same script using the windows command line (e.g. "perl test.pl"), the script is excuted properly. Do you have any suggestions about this phenomenon?
jploski wrote on Thu Nov 17 20:11:40 CET 2005:
The first line appears on the screen later because of the STDOUT buffering - this is not strictly EPIC-related and does not mean that statements are executed in a different order. Read about the special variable $| on the perlvar manual page. If you set it to 1 at the beginning of your script, it will behave the same in terminal mode and EPIC.
cisie_son wrote on Fri Nov 18 18:49:01 CET 2005:
Thank You very much for this hint! What I still don't understand: Why isn't Windows witch Active Perl affected by this flushing-methode?
jploski wrote on Fri Nov 18 19:07:05 CET 2005:
man perlvar says "STDOUT will typically be line buffered if output is to the terminal and block buffered otherwise." So it seems that perl.exe run by means of Java's Runtime.exec(...) can somehow detect that it is not run from terminal.
cisie_son wrote on Mon Nov 21 12:26:05 CET 2005:
Thank you again for helping a newbie :-)
Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.