Hello there,

I installed ActivePerl (I kept all default settings) and also downloaded Tk 804.028 and extracted it to C:\Tk-804.029.

I'm wondering why I keep on receiving this error whenever I run this simple script on my command prompt window (I'm using Windows XP Pro).

Can’t locate Tk.pm in @INC <@INC contains: C:/Perl/site/lib C:/Perl/lib .> at tk1.pl line 2

Here's the pl script... tk1.pl

#! c:\perl\bin\perl
use Tk;
# Main Window
my $mw = new MainWindow;
my $label = $mw -> Label(-text=>"Hello World") -> pack();
my $button = $mw -> Button(-text => "Quit", 
                           -command => sub { exit })
                 -> pack();
MainLoop;

Also, I tried to change the first line from #! c:\perl\bin\perl to #! c:\Tk-804.029\Tk but I encountered this error...

Can't exec c:\Tk-804.029\Tk at tk1.pl line 1.

Edited 6 Years Ago by Claude2005: Additional Information

What error message are you getting? The code runs fine on my Windows PC. I didn't have TK installed so I ran:

ppm install Tk

And it installed fine. Then the thing ran fine. BTW, the first line doesn't mean anything in Windows. Windows ignores it. It's only important in unix.

I got this error...

Downloading ActiveState Package Repository packlist...not found
ppm install failed: Can't find any package that provides Tk

I hate to be a pain but what should I do with it? Sorry for the noobish response but I'm just starting with Perl/Tk and doing these kinds of setup is something I'm not very good at.

You have to add that link to the repositories section of PPM. Do this:

Go to a command prompt.
Run PPM (type ppm)
The GUI should open.
Go to Edit->Preferences
Click on Repositories.
At the bottom add a repository.
You might check to see if "the u of winnipeg " is in the suggested.
Add that link with a name.
PPM will now search that repository which is more complete than activestate's.

Then install TK and run your script.

Sat 07/02/2011 15:35:01.17|C:\prj\zapdupes\zapdupes-1.6\perl|>ppm install Tk
ppm install failed: Can't find any package that provides Tk

This is with latest version of ActiveState Perl.
I think I will submit a bug report.

This article has been dead for over six months. Start a new discussion instead.