|We don't bite newbies here... much|
Perl:TK - standard output to text widgetby crabbdean (Pilgrim)
|on Feb 27, 2004 at 18:39 UTC||Need Help??|
crabbdean has asked for the wisdom of the Perl Monks concerning the following question:
Most simple perl programs are scripts run at the command line. To make them look a little more professional I'm writing a simple "standard gui" module with TK so that the scripts run in a nice gui style window. Its mostly written. But I have one problem I haven't been able to solve ...
Basically I want to capture STDOUT to a text-like widget. Now STDOUT is a stream, directed somewhere, for example to the terminal. I want to direct this to my text widget. I'm guessing I need to create a reference type glog of the STDOUT to my text-widget? Or open a filehandle to it or a pipe? Or call a subroutine in a loop that reads the STDOUT and appends it to the text-widget? As you can tell I'm not sure. Help?!
The bare guts of the code is below. Thoughts/comments/suggestions?