Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Where am I going wrong in the code for creating the first GUI using hello.pl?

by supriyoch_2008 (Scribe)
on Sep 17, 2012 at 13:28 UTC ( #994033=perlquestion: print w/ replies, xml ) Need Help??
supriyoch_2008 has asked for the wisdom of the Perl Monks concerning the following question:

Hi PerlMonks,

I am a beginner in perl programming. I have tried to create the first GUI using the hello.pl program. But I am getting an error in cmd like "Can't locate loadable object for module Tk::Event in @INC (@INC contains: C:/Per l/site/lib C:/Perl/lib .) at C:/Perl/lib/Tk.pm line 13". I have given the script of hello.pl and the Event.pm below. I am looking for help from perlmonks to sort out this problem in creating the GUI using hello.pl.

The code of hello.pl is given below:

#!/usr/local/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;

I have used the following Event.pm within Tk directory of perl lib installed in C drive of my laptop:

package Tk::Event; use vars qw($VERSION $XS_VERSION @EXPORT_OK); END { CleanupGlue() } $VERSION = sprintf '4.%03d', q$Revision: #15 $ =~ /\D(\d+)\s*$/; $XS_VERSION = '804.027'; use base qw(Exporter); use XSLoader; @EXPORT_OK = qw($XS_VERSION DONT_WAIT WINDOW_EVENTS FILE_EVENTS TIMER_EVENTS IDLE_EVENTS ALL_EVENTS); XSLoader::load 'Tk::Event',$XS_VERSION; require Tk::Event::IO; 1; __END__

I am getting the following error message again and again in cmd window.

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\x>cd desktop C:\Users\x\Desktop>hello.pl Can't locate loadable object for module Tk::Event in @INC (@INC contai +ns: C:/Per l/site/lib C:/Perl/lib .) at C:/Perl/lib/Tk.pm line 13 Compilation failed in require at C:/Perl/lib/Tk.pm line 13. BEGIN failed--compilation aborted at C:/Perl/lib/Tk.pm line 13. Compilation failed in require at C:\Users\x\Desktop\hello.pl line 2. BEGIN failed--compilation aborted at C:\Users\x\Desktop\hello.pl line +2. C:\Users\x\Desktop>

Comment on Where am I going wrong in the code for creating the first GUI using hello.pl?
Select or Download Code
Re: Where am I going wrong in the code for creating the first GUI using hello.pl?
by daxim (Chaplain) on Sep 17, 2012 at 13:42 UTC
    Which Perl distribution do you use, and what's the version number? I suspect Tk was not properly installed, how did you install it?
Re: Where am I going wrong in the code for creating the first GUI using hello.pl?
by zentara (Archbishop) on Sep 17, 2012 at 13:48 UTC
    Reinstall Tk properly., It sounds like you have a mismatch in binary version, something like you installed a ppm module compiled for one Perl version and Windows level, which dosn't match yours. Possibly did you upgrade your Perl version lately, and didn't rebuild Tk, or install the correct compatible Tk ppm.

    What version of Windows do you have, and how did you install Tk?


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://994033]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2014-10-31 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (221 votes), past polls