- or download this
my $doStdout = sub {
## $Qout is a [Thread::Queue] object onto which anything that
+ is printed to stdout is enqued by the "black magic".
...
}
}
};
- or download this
$mw->repeat( 500, $doStdout ); # execute $doStdout once every 500
+millisec...? but why mw->
Tk::MainLoop(); #OK
}
- or download this
use Thread::Queue;
...
tie *STDOUT, 'MyGuiStdout', $Qout;
# everything up to this point is pure black magic
- or download this
sub PRINT { $_[0]->enqueue( join ' ', @_[ 1 .. $#_ ] ); }
- or download this
package MyGuiStdin;
our @ISA = qw[ Thread::Queue ];
sub TIEHANDLE { bless $_[1], $_[0]; }
sub READLINE { $_[0]->dequeue(); }