user3189985
user3189985

Reputation: 189

Perl - Installing Tk module for Windows

I downloaded Tk module and installed it in Perl\lib.

I created the following perl file:

use Tk;
use strict;

my $mw = MainWindow->new;
$mw->geometry("200x100");
$mw->title("Frame Test");

$mw->Frame(-background => 'red')->pack(-ipadx => 50, -side => "left", -fill => "y");
$mw->Frame(-background => 'blue')->pack(-ipadx => 50, -side => "right", -fill => "y");

MainLoop;

Then, I tried to execute this file by typing "perl filename.pl" in command window, and the result was: "Can't locate Tk.pm in @INC"

Upvotes: 1

Views: 5134

Answers (1)

tjd
tjd

Reputation: 4104

The Tk module for Perl is an XS module with C code that needs compiling. Merely copying isn't sufficient. If you use ActiveState's Perl, you can download/install Tk using ppm provided you are either using one of the two most recent version or you are paying for an "enterprise" license. Otherwise use cpan or cpanm to do the installation. You'll also need a C compiler and a copy of nmake.

Upvotes: 3

Related Questions