Discussion:
Can't get passed 'use tk;' in my 1st perl/tk program.
(too old to reply)
Charles Bush
2005-07-04 16:59:10 UTC
Permalink
I'm trying to run my 1st perl/tk program and can't get passed the
"use Tk;" command. I get error, "Can't locate Tk.pm" and if I add a "use
lib" pointer to directory containing Tk.pm, I get error message "Can't
locate loadable object for module Tk::Event". SEE BELOW for actual
scripts and error messages.

Environment: Mac OS x 10.3.8; perl version 5.8.1; Tk directory
Tk-804.027.
Experince level: Used to write lots of perl code, 15 years ago on
Sun/unix. Just wrote my 1st perl code on MAC. This is my first try at
perl/Tk. First try at posting to a newsgroup.

I'm using Binny V A's tutorial,
http://www.geocities.com/binnyva/code/perl/perl_tk_tutorial/. Thanks
Binny.

Any help would be appreciated.

Chuck


=======script i use to make pmdirectory in ~/.cpan/build/Tk-804.027 ====
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install Tk
=======================================



================= perl/tk test program called testtk.pl ===
#!/usr/local/bin/perl
use Tk;

my $mw = new MainWindow;#Create the Main Window
my $label = $mw -> Label(-text=>"Hello World") -> pack();
my $button = $mw -> Button(-text => "Quit",
-command => sub { exit })
-> pack();
MainLoop;
==================================

============== error message on running "perl testtk.pl"
Can't locate Tk.pm in @INC (@INC contains:
/System/Library/Perl/5.8.1/darwin-thread-multi-2level
/System/Library/Perl/5.8.1
/Library/Perl/5.8.1/darwin-thread-multi-2level
/Library/Perl/5.8.1
/Library/Perl
/Network/Library/Perl/5.8.1/darwin-thread-multi-2level
/Network/Library/Perl/5.8.1
/Network/Library/Perl .) at testtk.pl line 2.
BEGIN failed--compilation aborted at testtk.pl line 2.
============================================================


===== if I add; use lib "/Users/charlesbush/.cpan/build/Tk-804.027" to
program I get error =============================================
Can't locate loadable object for module Tk::Event in @INC (@INC
contains: /Users/charlesbush/.cpan/build/Tk-804.027
/System/Library/Perl/5.8.1/darwin-thread-multi-2level
/System/Library/Perl/5.8.1
/Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1
/Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level
/Network/Library/Perl/5.8.1 /Network/Library/Perl .) at
/Users/charlesbush/.cpan/build/Tk-804.027/Tk.pm line 13
Compilation failed in require at
/Users/charlesbush/.cpan/build/Tk-804.027/Tk.pm line 13.
BEGIN failed--compilation aborted at
/Users/charlesbush/.cpan/build/Tk-804.027/Tk.pm line 13.
Compilation failed in require at testtk.pl line 3.
BEGIN failed--compilation aborted at testtk.pl line 3.
Undefined subroutine &Tk::Event::CleanupGlue called at
/Users/charlesbush/.cpan/build/Tk-804.027/Tk/Event.pm line 3.
END failed--call queue aborted at testtk.pl line 3.
=====================================================================
krkeegan
2005-07-06 17:54:42 UTC
Permalink
It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?

Kevin
Charles Bush
2005-07-07 04:34:17 UTC
Permalink
Post by krkeegan
It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?
Kevin
Your right, 1st attempt to install ANY module. I thought that doing the
suggested ----

perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install Tk

would have install Tk properly.

I see a makefile and install.pm in my Tk-804.026 directory. Maybe I am
suppose to do something with them?

Any suggestions?

Chuck
zentara
2005-07-07 12:37:55 UTC
Permalink
Post by Charles Bush
Post by krkeegan
It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?
Kevin
Your right, 1st attempt to install ANY module. I thought that doing the
suggested ----
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install Tk
would have install Tk properly.
I see a makefile and install.pm in my Tk-804.026 directory. Maybe I am
suppose to do something with them?
Any suggestions?
I don't know anything about the Mac, but try building Tk from source
yourself, and see if any errors are generated.

Go to http://cpan.org
Search for Tk, and download the source tarball, like
Tk-804.027.tar.gz

tar -zxvf Tk-804.027.tar.gz

cd Tk-804.027
perl Makefile.PL
make
make test
make install ( as root if Mac has such a thing )


Post what errors you get, if any.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
lusol
2005-07-07 13:26:41 UTC
Permalink
Post by zentara
Post by Charles Bush
Post by krkeegan
It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?
Kevin
Your right, 1st attempt to install ANY module. I thought that doing the
suggested ----
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install Tk
would have install Tk properly.
I see a makefile and install.pm in my Tk-804.026 directory. Maybe I am
suppose to do something with them?
Any suggestions?
I don't know anything about the Mac, but try building Tk from source
I do. See:

http://www.lehigh.edu/~sol0/Macintosh/X/ptk/
Post by zentara
yourself, and see if any errors are generated.
Go to http://cpan.org
Search for Tk, and download the source tarball, like
Tk-804.027.tar.gz
tar -zxvf Tk-804.027.tar.gz
cd Tk-804.027
perl Makefile.PL
make
make test
make install ( as root if Mac has such a thing )
Of course it does, it's just another Unix ...
Post by zentara
Post what errors you get, if any.
Steve
--
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;
Charles Bush
2005-07-07 17:44:17 UTC
Permalink
Post by zentara
Post by Charles Bush
Post by krkeegan
It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?
Kevin
Your right, 1st attempt to install ANY module. I thought that doing the
suggested ----
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install Tk
would have install Tk properly.
I see a makefile and install.pm in my Tk-804.026 directory. Maybe I am
suppose to do something with them?
Any suggestions?
I don't know anything about the Mac, but try building Tk from source
yourself, and see if any errors are generated.
Go to http://cpan.org
Search for Tk, and download the source tarball, like
Tk-804.027.tar.gz
tar -zxvf Tk-804.027.tar.gz
cd Tk-804.027
perl Makefile.PL
make
make test
make install ( as root if Mac has such a thing )
Post what errors you get, if any.
Executing perl Makefile.PL gives the following messages ........

perl is installed in
/System/Library/Perl/5.8.1/darwin-thread-multi-2level okay
PPM for perl5.008001
Test Compiling config/signedchar.c
Test Compiling config/Ksprintf.c
Test Compiling config/tod.c
Test Compiling -DTIMEOFDAY_TZ config/tod.c
TZ gettimeofday()
Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.dylib
Cannot find X include files via /usr/X11R6/include
Cannot find X include files anywhere at ./myConfig line 332.
Compilation failed in require at Makefile.PL line 36.
BEGIN failed--compilation aborted at Makefile.PL line 38.

NOTE: The same errors occur with Tk-800.024, Tk-804.026, and Tk-804.027.
I found no Tk-804.025.

I think I may need a later version of perl? I have perl version 5.8.1
but I can't find a download for ANY perl in www.apple.com?



Thanks for your help, zentara.

Chuck
lusol
2005-07-07 19:01:55 UTC
Permalink
Post by Charles Bush
Executing perl Makefile.PL gives the following messages ........
perl is installed in
/System/Library/Perl/5.8.1/darwin-thread-multi-2level okay
PPM for perl5.008001
Test Compiling config/signedchar.c
Test Compiling config/Ksprintf.c
Test Compiling config/tod.c
Test Compiling -DTIMEOFDAY_TZ config/tod.c
TZ gettimeofday()
Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.dylib
Cannot find X include files via /usr/X11R6/include
Cannot find X include files anywhere at ./myConfig line 332.
Compilation failed in require at Makefile.PL line 36.
BEGIN failed--compilation aborted at Makefile.PL line 38.
You need to install X11.app (X11 development) from your Mac OS X CDs/DVD.

Steve
--
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;
Charles Bush
2005-07-07 19:25:09 UTC
Permalink
Post by Charles Bush
I think I may need a later version of perl? I have perl version 5.8.1
but I can't find a download for ANY perl in www.apple.com?
Thanks for your help, zentara.
Chuck
To answer my own question the perl downloads are in
http://www.cpan.org/src/5.0/. Now the questions are;
1. which version of perl should I install for MAC OSX 10.3.8? Or does
it matter?

2. my Perl 5.8.1 seems to run fine. Will I be able to uninstall a
later version if I muck up the installation?

Chuck
Arthur Schwarz
2005-07-07 19:31:53 UTC
Permalink
Post by Charles Bush
Post by zentara
Post by Charles Bush
Post by krkeegan
It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?
Kevin
Your right, 1st attempt to install ANY module. I thought that doing the
suggested ----
perl -MCPAN -e shell
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install Tk
would have install Tk properly.
I see a makefile and install.pm in my Tk-804.026 directory. Maybe I am
suppose to do something with them?
Any suggestions?
I don't know anything about the Mac, but try building Tk from source
yourself, and see if any errors are generated.
Go to http://cpan.org
Search for Tk, and download the source tarball, like
Tk-804.027.tar.gz
tar -zxvf Tk-804.027.tar.gz
cd Tk-804.027
perl Makefile.PL
make
make test
make install ( as root if Mac has such a thing )
Post what errors you get, if any.
Executing perl Makefile.PL gives the following messages ........
perl is installed in
/System/Library/Perl/5.8.1/darwin-thread-multi-2level okay
PPM for perl5.008001
Test Compiling config/signedchar.c
Test Compiling config/Ksprintf.c
Test Compiling config/tod.c
Test Compiling -DTIMEOFDAY_TZ config/tod.c
TZ gettimeofday()
Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.dylib
Cannot find X include files via /usr/X11R6/include
Cannot find X include files anywhere at ./myConfig line 332.
Compilation failed in require at Makefile.PL line 36.
BEGIN failed--compilation aborted at Makefile.PL line 38.
NOTE: The same errors occur with Tk-800.024, Tk-804.026, and Tk-804.027.
I found no Tk-804.025.
I think I may need a later version of perl? I have perl version 5.8.1
but I can't find a download for ANY perl in www.apple.com?
Thanks for your help, zentara.
Chuck
I just poted a Newbie question on the same topic. I am unable to build
Tk on a PC (either Win2K or WinXP). 'make' fails with errors. I've fixed
one in pTk/mTk/xlib/X11/Xlib.h, '#include "../pTk/tkIntXlibDecls.h"'
needed to be changed '#include "../../../pTk/tkIntXlibDecls.h"'. Another
error was recorded (after the fix) which I'll be working on tonight. It
appears that the release of 'Tk-804.027' was done without some sort of
internal (and thorough) checking, or the instructions (which I did try
to follow) is flawed, or quite as likely, I'm a blithering idiot unable
to type:

perl Makefile.PL
make

as shown in README.cygwin.

And so it goes.

Any help for Chuck or I would really be appreciated.

art
lusol
2005-07-08 00:41:24 UTC
Permalink
Post by Charles Bush
NOTE: The same errors occur with Tk-800.024, Tk-804.026, and Tk-804.027.
I found no Tk-804.025.
I think I may need a later version of perl? I have perl version 5.8.1
but I can't find a download for ANY perl in www.apple.com?
Are my answers not reaching you? I have "fixed" all your problems ..

Steve
--
@_=map{eval"100${_}"}split/!/,'/5!*2!+$]!/10+$]';use Tk;$m=tkinit;$t='just an'.
'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
z(@_[2,3],-te,$t,-fi,'gray50');$c->$z($_[2]-$],$_[3]-$],-te,$t);$m->bind('<En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;
Loading...