gri6507 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have a Tk GUI that could be running on one Solaris machine and display on another. Of course, everything works when the displaying machine has added the running machine's info to its xhost list. But let's say that this is not the case. In other words, the running machine is not allowed to display on the displaying machine. Then, you get the follwing error:

Xlib: connection to "displayingMachine:0.0" refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key couldn't connect to display "displayingMachine:0.0" at /usr/local/Acti +vePerl-5.6/lib/site_perl/5.6.1/sun4-solaris-thread-multi/Tk/MainWindo +w.pm line 55, <STDIN> line 1. MainWindow->new(-title,CalTool,-width,500) at cal.pl line 860
Of course, the first two messages are coming from the XLib and are important. However, I would really like to NOT display the other two messages, yet there seems to be no documentation on how to do that. Does anyone have any ideas? Thanks.

Replies are listed 'Best First'.
Re: Tk::MainWindow->new() XLib error
by ptkdb (Monk) on Nov 14, 2003 at 22:27 UTC
    Have you tried putting 'eval' around your script?
    eval { require Tk ; MainWindow->new() ; MainLoop ; } ;