Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl/Tk package 2

Status
Not open for further replies.

subtelo

Programmer
Jan 9, 2005
25
US
Want to use Perl/Tk for graphical tool in perl script. But it is not installed in my current RedHat Enterprise 5. Does anybody can give me a hint which package contain it and where I can download it. Thanks.
 
Thanks for the code. It is worked.

Now there is another problem. When I try ssh to the Linux machine using a window XP machine. DO you know what this error message mean when I run the code.

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

couldn't connect to display ":0" at /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/Tk/MainWindow.pm line 55.
MainWindow->new(-title,My Application) at test.pl line 5

I already open the Exceed as X windonw in Window XP. Thanks.
 
Perl/Tk requires an X Window System server to display its GUI. I'm not familiar with Exceed or how it works, though. This is a question for a different forum now (how to display X apps remotely on a Windows XP desktop).

The only way I know of for sure to run remote X apps is on a Linux workstation, by opening the SSH connection with the -X option (ssh -X user@hostname). I haven't tested any solutions for Windows PCs though.

You might just need to make sure that :0 is the correct X display. Normally when logged on locally to a server :0 is used, but for remote connections it might use :1 or :2 or any other number. The environment variable $DISPLAY needs to be set to the right value (on my Linux desktop it's set to ":0.0"). I assume Perl/Tk knows to get the value from $DISPLAY so this should work. If Tk doesn't do that, then you'll have to google it. I've only ever needed to run Tk on display :0.

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
Update:

I tried doing `export DISPLAY=:1.0` on my local terminal and then running a Perl/Tk app, and got the same error as you (only it was about the :1.0 display instead).

Code:
[kirsle@firefly PCCC-3.0_src]$ export DISPLAY=:1.0
[kirsle@firefly PCCC-3.0_src]$ echo $DISPLAY
:1.0
[kirsle@firefly PCCC-3.0_src]$ ./PCCC.pl 
LinkerThread activated.
MediaThread activated.
Detecting your OS... linux
Detecting your home directory... /home/kirsle
Setting home directory to /home/kirsle/.pccc
Reading configuration from /home/kirsle/.pccc/config.txt
couldn't connect to display ":1.0" at /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi/Tk/MainWindow.pm line 55.
MainWindow->new(-title,Perl CyanChat Client) at ./PCCC.pl line 221
Perl exited with active threads:
	2 running and unjoined
	0 finished and unjoined
	0 running and detached
[kirsle@firefly PCCC-3.0_src]$ export DISPLAY=:0.0
[kirsle@firefly PCCC-3.0_src]$ echo $DISPLAY
:0.0
[kirsle@firefly PCCC-3.0_src]$ ./PCCC.pl 
LinkerThread activated.
MediaThread activated.
Detecting your OS... linux
Detecting your home directory... /home/kirsle
Setting home directory to /home/kirsle/.pccc
Reading configuration from /home/kirsle/.pccc/config.txt

Cuvou.com | My personal homepage
Code:
perl -e '$|=$i=1;print" oo\n<|>\n_|_";x:sleep$|;print"\b",$i++%2?"/":"_";goto x;'
 
I solved the problem by doing something same as ssh -X username@localmachine. Since I use a graphic interface "ssh secure shell" to do ssh, I forget to check the tunneling X11 connection. [blush]
Thank you very much for all you valuable information. You are really a professional perl programmer. Hope I can see your input again once I have problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top