Perl/Tk for OS X?

Joined
Dec 13, 2007
Messages
72
Reaction score
4
Points
8
Location
Toronto, ON
Your Mac's Specs
White MacBook | Core2Duo 2.2GHz | 4GB RAM | 120GB HDD | OS X 10.6.2
I've installed XCode and it came with a lot of nice extras like gcc, etc. However, what I'm really looking for is Perl/Tk, but haven't been able to find any sites with some good information on it. So does anyone know where I can get Perl/Tk for OS X (in my case, Leopard). Thanks.
 
Joined
Mar 14, 2005
Messages
443
Reaction score
3
Points
18
Location
Atlanta, GA
Your Mac's Specs
17" Macbook Pro Unibody 2.66 Ghz and Powerbook G4 1.67 GHz 2.0GB RAM
You have installed the developer tools right? Well, I haven't tried it yet, but I was planning on installing this soon too.

This was the link I found.

http://perlprimer.sourceforge.net/download.html

Tell me if it works for you. I will reply back sometime this weekend with my success or failure. I would go ahead and try it now, but I have a final tomorrow and I want to stay on track.
 
OP
2Hit6
Joined
Dec 13, 2007
Messages
72
Reaction score
4
Points
8
Location
Toronto, ON
Your Mac's Specs
White MacBook | Core2Duo 2.2GHz | 4GB RAM | 120GB HDD | OS X 10.6.2
Joined
Feb 27, 2009
Messages
1
Reaction score
0
Points
1
unfortunately the information there no longer works for 10.4, even with the developer tools, X11 and other attempts like ActivePerl installed.
 
Joined
Sep 10, 2008
Messages
61
Reaction score
1
Points
8
Here is a how-to for Leopard. I just did this on my new Imac and it works. I am still a Mac newbie, but have been using Unix/Linux for decades and Perl-Tk for years. You can make really neat, small and fast gui programs with Tk without all the overhead of the super suites like Netbeans.

First, go to cpan.org and download Tk-804.028 by selecting modules and doing a search. It is about 6 meg and comes as a tar/gz file. No problem, Leopard will recognize it. Unzip it.

Make sure that you have Xcode tools loaded and definitely the Unix development part of it. Since Leopard is on top of FBSD Unix, Tk can definitely be installed without Xcode - I just don't know how yet on a Mac. I am afraid that at the my current level of knowledge of Leopard that I might totally unhook the GUI from the OS. But, the following way works fine.

Now, open a terminal session and move into the folder that you have unzipped Tk into.

Give the following commands without the quotes (note: case sensitive!) ...

"perl Makefile.PL" This will take just a short while.

"make" This will take several minutes. Don't panic if you think you see warnings and errors go by. That is normal for Unix.

"make test" Now you will see examples appear as it tests the compile. Again, don't worry if it says that it failed some tests when it is done. I have never seen an install that gives a 100 percent pass even on a pure Unix machine.

So far, nothing done has changed anything on your machine. You can dump this folder and everything is gone. Or even run the process again if you want to watch it again.

The following will install the compiled TK on your machine.

"sudo make install" It will ask for your password and then install in a few seconds.

Thats it. Just be sure that you put the line...
use Tk;
in your perl program.

Also, you HAVE to have the book, "Mastering Perl/Tk" (by Lidie and Walsh) if you are serious about Tk. (BookFinder.com: Search for New & Used Books, Textbooks, Out-of-Print and Rare Books) Don't even try programming Tk without this book. It has Everything that you can do with Tk and is actually understandable by a Tk newbie.

Konan
 
Joined
Sep 10, 2008
Messages
61
Reaction score
1
Points
8
*** Warning ***

Snow Leopard breaks Perl/Tk big time. If you have a pre-SL production machine that has to run Tk, don't upgrade yet. So far, after a day of hacking, I have finally managed to get Tk installed, but not totally working.

Konan
 
Joined
Aug 31, 2009
Messages
1
Reaction score
0
Points
1
Possible Tk issue fixed for Snow Leopard

I have just installed the following developer beta from PerlTk under Snow Leopard and it fixed my problems:

Slaven Rezić / Tk-804.028_501 - search.cpan.org

I was getting the "no event type or button # or keysym <snip> Widget.pm ..." error on my programs after building the 804.028 release version.

Just ungzip/untar and do a standard perl Makefile.PL; make install
 
Joined
Sep 10, 2008
Messages
61
Reaction score
1
Points
8
Great. That fixed it for my Snow Leopard also.

I finally got the old version to running by using the old GCC and library, but it is a temporary and fragile solution that any update would probably break.

This is much better. Now I can move to SL permanently.

If he had a donate button, I would gladly contribute.

Thanks
Konan
 
Joined
Sep 6, 2009
Messages
1
Reaction score
0
Points
1
I have just installed the following developer beta from PerlTk under Snow Leopard and it fixed my problems:

Slaven Rezić / Tk-804.028_501 - search.cpan.org

I was getting the "no event type or button # or keysym <snip> Widget.pm ..." error on my programs after building the 804.028 release version.

Just ungzip/untar and do a standard perl Makefile.PL; make install

I'm trying to build Perl/Tk on my SL box, downloaded Tk-804.028_501, did the standard build, but I'm still getting

Code:
no event type or button # or keysym at /Library/Perl/5.10.0/darwin-thread-multi-2level/Tk/Widget.pm line 1105.

It seems to be triggered by this:

Code:
# Main display area - search results
our $searchboxframe = $mw->Frame();
$mainbox = $searchboxframe->Scrolled(
    'HList',
    -scrollbars       => 'osoe',
    -background       => 'white',
    -selectbackground => 'navy',
    -selectforeground => 'white',
    -width            => 100,
    -selectmode       => "extended"
  )->pack(
    -fill   => 'both',
    -expand => 1,
    -side   => 'top'
  );

Any thoughts on what I might try?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Why not use something like MacPorts to compile Perl/TK? I think the package you want is p5-tk. According to the description in the aforementioned link, it is "a Perl interface to Tk".
 
Joined
Sep 10, 2008
Messages
61
Reaction score
1
Points
8
Why not use something like MacPorts to compile Perl/TK? I think the package you want is p5-tk. According to the description in the aforementioned link, it is "a Perl interface to Tk".

I was looking at p5-tk when I was having problem with PerlTK. But I could not find a single solitary site with info/manuals/docs about the package. And it appears that it is what Linux people call an 'orphaned' package. That is, there appears to be no maintainer of the code which to me, means that it is dead.

Didn't want to base my programming around a key module that may or may not disappear tomorrow.

Konan
 
Joined
Nov 10, 2009
Messages
1
Reaction score
0
Points
1
I tried Tk-804.028_501 on Snow Leopard. But the "make test" give me this:
dyld: lazy symbol binding failed: Symbol not found: _png_create_write_struct
Referenced from: /User/k/perl/Tk-804.028_501/blib/arch/auto/Tk/PNG/PNG.bundle
Expected in: flat namespace
And I cannot open PNG image files in Perl/Tk windows.

I installed libpng separately, but no luck.

Any help or hints please?

Thanks and sorry for my poor English.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top