Hi.

OK. This is probably the strangest and most baffling fix I could have
stumbled on for this bug but here goes:

IO flushing.

Yep. If you flush *any* filehandle currently open for writing (by
whatever means you like) immediately after calling Win32::GUI::DoEvents,
you don't get repeated messages. Flushing in the actual DoEvents C code
doesnt work, the flush must be done in Perl, and outside of any event
handler. You can even flush a filehandle you just open()ed for writing.
Don't ask me.

This works (uses IO::Handle to flush stdout):

use IO::Handle;
my $io = new_from_fd IO::Handle(1,">");
while(1) {
        Win32::GUI::DoEvents;
        $io->flush();
}

As does this (uses print to flush):

while(1) {
        Win32::GUI::DoEvents;
        print "\n";
}

And this (uses print and autoflush to prevent filling the console with
emptiness):

$| = 1;
while(1) {
        Win32::GUI::DoEvents;
        print " \010";
}

Now if anyone can explain away THIS behaviour I'll be really impressed.
I did try to dig through perl's internals to find out exactly WHAT it
does on flush (I suspect it's slightly more than just an fflush() ).
Could this possibly be anything to do with the "<DATA> line xxx" i see
in every console warning message created by Win32::GUI ?? What *is* that
all about?

Steve

Reply via email to