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>
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.