Code Comments
Programming Forum and web based access to our favorite programming groups.I want to remove my command shell from my perl tk app yet i would like to still be able to see perl and Tk errors when they happen. I currently have a ROText widget for my application status - and would like this to be the place where any error from the .pl or specific to Tk to be inserted. Is there a way to do this? Thanks, John
Post Follow-up to this messageJohnny Google wrote: > I want to remove my command shell from my perl tk app yet i would like > to still be able to see perl and Tk errors when they happen. > > I currently have a ROText widget for my application status - and would > like this to be the place where any error from the .pl or specific to > Tk to be inserted. > > Is there a way to do this? > > Thanks, > > John > see this article: [url]http://groups.google.com/groups?hl=en&lr=&selm=Uk73c.5228%24zu.2733%40newsfe1-win[ /url]
Post Follow-up to this messageOn 9 Nov 2004 12:18:24 -0800, "Johnny Google" <john_pataki@yahoo.com> wrote: >I want to remove my command shell from my perl tk app yet i would like >to still be able to see perl and Tk errors when they happen. > >I currently have a ROText widget for my application status - and would >like this to be the place where any error from the .pl or specific to >Tk to be inserted. > >Is there a way to do this? Just put require Tk::ErrorDialog; at the top of your Tk script...works for me. That will pop up an error message in a separate toplevel. To redirect it to your ROText widget, you probably want to close STDERR, then reopen it to a filehandle, then use fileevent to read it and put it in your ROText. Here are a couple of other ideas for you. ##################################### #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::Stderr; my $mw = MainWindow->new->InitStderr; print STDERR 'stuff'; ## goes to standard error window warn '!'; ## likewise MainLoop; #################################### or ######################################## # #!/usr/bin/perl -w use Tk; $mw = MainWindow->new; $text= $mw->Text( '-width' => 40, '-height' => 20)->pack; tie *STDERR, ref $text, $text; $SIG{__WARN__} = sub { print STDERR @_ }; print STDERR "blah blah blah"; $something = 'hoo hah'; print "$something\n"; MainLoop; ######################################## # -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.