Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Win32::Console problem

by BrowserUk (Patriarch)
on Nov 23, 2009 at 02:09 UTC ( [id://808716]=note: print w/replies, xml ) Need Help??


in reply to Win32::Console problem

Add $|++; at the top of the program.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Win32::Console problem
by hoffy (Acolyte) on Nov 23, 2009 at 04:55 UTC

    Thanks! Seems so simple and it works!

    Now, I do have a non essential quest for knowledge....why did it work on V5.6 but no V5.8?

      why did it work on V5.6 but no V5.8?

      The rules regarding automatic flushing of the STDOUT buffer changed from perl-5.6 to perl-5.8. Setting $| (or incrementing it from 0 to 1, as per BrowserUk's approach) is the way to make sure that the perl-5.8 STDOUT buffer gets flushed in much the same way as happened automatically with perl-5.6.

      For a simple demo of the difference, the following outputs hellogoodbye on 5.6, but goodbyehello on 5.8:
      perl -e "print STDOUT \"hello\";print STDERR \"goodbye\""
      Setting $| will ensure that hellogoodbye is output on both 5.6 and 5.8:
      perl -e "$|=1;print STDOUT \"hello\";print STDERR \"goodbye\""
      Cheers,
      Rob
      why did it work on V5.6 but no V5.8?

      I have no idea.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://808716]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found