Operating System: Ubuntu 10.10 - the Maverick Meerkat
Checking if perl is in my environment PATH:
root@marc# which perl
The above output tells me that i have perl running on my machine otherwise it would return something like “command not found” or an empty string!
Checking the version of perl am running:
root@marc# perl -v
This is perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi
(with 40 registered patches, see perl -V for more detail)
Then I tried a test script to check if my default perl installation already has a Tk module but no luck! which means I had to install the perl Tk module, there are two ways:
1. Download the archive and manually install perl-Tk:
Download Link: CPAN
|Perl scripting with Tk to add Graphical User Interfaces|
# tar -xvf Tk-804.028.tar
change to the Tk dir: #cd Tk-804.028
2. Use cpan to install Tk (this is the easier and recommended option)
Make sure you are root otherwise the installation script will have permission issues!
// if you are on a direct internet connection, cpan will automatically download the required modules and the dependencies from CPAN using ftp.
//if you computer is behind a proxy that requires authentication, then you have to modify the cpan config. this is how you add the proxy configuration in cpan.
cpan> o conf init /proxy/
Your ftp_proxy? [ftp://10.192.1.101:3128/]
//cpan tries to automatically detect the proxy as show above, enter
Your http_proxy? [http://10.192.1.101:3128/]
Your no_proxy? 
//for IPs that you want excluded from the proxy config, you can leave this blank and enter
If your proxy is an authenticating proxy, you can store your username
permanently. If you do not want that, just press RETURN. You will then
be asked for your username in every future session.
Your proxy user id? [joshua]
Your password for the authenticating proxy can also be stored
permanently on disk. If this violates your security policy, just press
RETURN. You will then be asked for the password in every future
CPAN: Term::ReadKey loaded ok (v2.30)
Your proxy password?
Please remember to call 'o conf commit' to make the config permanent!
//cpan will download and install TK
//during the installation test phase, you will see a lot of pop ups, that means that your Tk library is being built and it’s an exciting moment :-)
Test your installation, try to run a script that calls the Tk module ( use Tk; ). if the script runs without errors then you are good to go. Your environment it set to run perl with Tk.
In the next posts, i will be sharing my experience with perl + Tk GUIs, this was basically about setting up the development environment and i hope you did the same.
for windows, you don’t have to go through this hustle, just go to ActiveState and download perl for your Windows OS, it comes with all the libraries including Tk.
Download Link: ActiveState
|Active State Perl|