f



Can't get passed 'use tk;' in my 1st perl/tk program.

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.
=====================================================================
0
Charles
7/4/2005 4:59:10 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

9 Replies
890 Views

Similar Articles

[PageSpeed] 34

It looks like you have not properly installed Tk into you module
library. Have you installed other modules in the past?

Kevin

0
krkeegan
7/6/2005 5:54:42 PM
In article <1120672482.478177.319950@f14g2000cwb.googlegroups.com>,
 "krkeegan" <email@krkeegan.com> wrote:

> 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
0
Charles
7/7/2005 4:34:17 AM
On Wed, 06 Jul 2005 21:34:17 -0700, Charles Bush <cb386z7.nt@cox.net>
wrote:

>In article <1120672482.478177.319950@f14g2000cwb.googlegroups.com>,
> "krkeegan" <email@krkeegan.com> wrote:
>
>> 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
0
zentara
7/7/2005 12:37:55 PM
zentara <zentara@highstream.net> wrote:
> On Wed, 06 Jul 2005 21:34:17 -0700, Charles Bush <cb386z7.nt@cox.net>
> wrote:
> 
> >In article <1120672482.478177.319950@f14g2000cwb.googlegroups.com>,
> > "krkeegan" <email@krkeegan.com> wrote:
> >
> >> 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/


> 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 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;
0
lusol
7/7/2005 1:26:41 PM
In article <l06qc1hlg7f4kbuh4f8qmkhfo0hlig4jbr@4ax.com>,
 zentara <zentara@highstream.net> wrote:

> On Wed, 06 Jul 2005 21:34:17 -0700, Charles Bush <cb386z7.nt@cox.net>
> wrote:
> 
> >In article <1120672482.478177.319950@f14g2000cwb.googlegroups.com>,
> > "krkeegan" <email@krkeegan.com> wrote:
> >
> >> 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
0
Charles
7/7/2005 5:44:17 PM
Charles Bush <cb386z7.zz@cox.net> wrote:
> 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;
0
lusol
7/7/2005 7:01:55 PM
In article <cb386z7.zz-3A5703.10441707072005@news.west.cox.net>,
 Charles Bush <cb386z7.zz@cox.net> wrote:


> 
> 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
0
Charles
7/7/2005 7:25:09 PM
Charles Bush wrote:

> In article <l06qc1hlg7f4kbuh4f8qmkhfo0hlig4jbr@4ax.com>,
>  zentara <zentara@highstream.net> wrote:
> 
> 
>>On Wed, 06 Jul 2005 21:34:17 -0700, Charles Bush <cb386z7.nt@cox.net>
>>wrote:
>>
>>
>>>In article <1120672482.478177.319950@f14g2000cwb.googlegroups.com>,
>>>"krkeegan" <email@krkeegan.com> wrote:
>>>
>>>
>>>>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
0
Arthur
7/7/2005 7:31:53 PM
Arthur Schwarz <aschwarz@acm.org> wrote:
> Charles Bush wrote:
> 

> > 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;
0
lusol
7/8/2005 12:41:24 AM
Reply: