#47 NO Console output during script execution

open
nobody
None
5
2003-02-12
2003-02-12
Anonymous
No

I am using Open_Perl_IDE_1.0.11.409 on XP
plus Perl5.8_patch.

A simple script like

while (<STDIN>){
chomp;
if(/^$/) {last;};
print "next line ";
# open IDE prints only after execution?!?!?
}
asking for input cannot be executed (RUN) since the
output only appears in the console window AFTER
script execution. One has to give the input blindly. It
works in debug mode (step over).

d_dkdk@hotmail.com

Discussion

  • Nobody/Anonymous

    Logged In: NO

    while(<STDIN>){

    print $_;

    }

    STDIN does not provide an eof. When runing the same from
    the console I would normally enter control+z which
    provides the eof and the loop exits.

    when testing from the open perlide the control+z the
    script doesn't exit.

    If you run perl and don't specify an input file from the
    console you have to use control+z to make perl exit and
    print to the console.

    perl.exe

    print "apple";
    ^Z
    apple

     
  • Axel Maier

    Axel Maier - 2003-11-22

    Logged In: YES
    user_id=832951

    That's the same by myself.

     
  • Chris Evelo

    Chris Evelo - 2004-05-25

    Logged In: YES
    user_id=1049295

    You can prevent this by adding:

    $| = 1;

    as the first line in your program. That will prevent buffering of
    output.

    Thanks to Frank Neven for pointing this out to me.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks