RE: how to run Perl programs within Eclipse?

perl999 wrote on Mon Jun 20 13:18:11 MEST 2005:
Ordinary:

kalle
My inputted text
eva
Beata

Through Eclipse and the output in the console view:

My inputted text
kalle
eva
Beata

Why are the prints only fushed in the console view at the termination of
the program in the Eclipse environment why not as in real?
Are ther afeature i have missed to get things right?
perl999 wrote on Mon Jun 20 13:48:24 MEST 2005:
Forgot to add the test script.

$hej="kalle";
$ss="eva";
print $hej . "\n";
$hej="Beata";
$gurgel=;
print "$ss\n$hej\n";
mathieulongtin wrote on Mon Jun 20 14:30:26 MEST 2005:
Something to do with output buffering. 

When perl is run in a console, it autoflushes STDOUT, but if it thinks its
redirected to a file, it doesn't. This makes for better performance, but
messes up IDEs.

You could put "$| = 1;" (without the quotes) at the start of your script,
that would force autoflush, regardless of whether you're running in the
console or not.

Another thing to note is that STDERR and STDOUT outputs seem out of order
when used in an IDEs. I have had weird result with that even with autoflush
turned on.

-Mathieu


perl999 wrote on Mon Jun 20 14:42:36 MEST 2005:
Thanks a lot, you are todays hero.
Rapid answer and relevant.
Thanks:
/The Beginner

Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.