Thursday, December 1, 2011

Perl - Installing Tk on Strawberry Perl

v 0.2

I recently started looking at the options for using Perl on Windows.  One can install it through Cygwin, which may be a good option, or install either the Activestate or Strawberry versions.

I first stumbled across Strawberry when I spotted a random quote that Larry Wall uses it when he has to use Windows, so I looked further.  It is open source and comes with its own C compiler suite for use in installing Cpan modules.  I liked that Strawberry was more closely integrated with Cpan than Activestate, although the latter has its own Perl Package Manager.

Then I thought I'd like to look at using the Tk graphical toolkit with Perl, and discovered that it didn't appear to be included in either product.  I thought it would be a good opportunity to try installing Tk on Strawberry using the " cpan " facility.  So started an adventure that almost had me uninstalling the whole thing and going to Activestate.

Now, I'd installed the 32 bit version of Strawberry 5.12 on my 64 bit Win7 box.  No matter what I did, the installation failed when  " dmake " was unable to recognise some file extensions in the compiler suite.  So in a last ditch effort, I uninstalled the 32 bit version and downloaded the 64 bit Strawberry 5.14 preview and installed that.  The appropriate directories were in the "path" and so I opened a command line window and typed:

cpan Tk

It all downloaded and dmake built the Tk system however when dmake tried to test, the test failed and dumped me back to the command line.  All was not lost however, since there is only one more step needed, the actual install.  I changed to the downloaded and unpacked Tk source directory in " cpan\build " and simply typed:

dmake install

and the installation completed.  Here is some advice I found in my searching to manually install Cpan modules in Strawberry if you need to:

http://www.perlmonks.org/?node_id=841828
-----------------------------------------------------------------------
Try manual installation if CPAN install fails. Try following:
1. Download tar.gz file
2. Extract using Winzip or 7zip
3. go to the folder "Tk-804.028_503" in command prompt
4. type: dmake
5. type: dmake test
5. type: dmake install
----------------------------------------------------------------------

Anyway, I now have a working Tk module in my Perl install - I shall monitor the situation, since this is a little complex if you have a client that needs to install Perl/Tk .....


Later