Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Compilation failed in require' error

Status
Not open for further replies.

SSG1

Programmer
Jan 17, 2002
48
US
Hi All,
I downloaded some Win32 PERL modules and installed them and followed the foll procedure:
perl makefile.pl
make
make test
make install
These seem to have gone through fine. However, when I try to run the code, I get "compilation failed in require".
Can anyone help with this ?

Thanks a lot.
 
Was the require statement in your script? Are you sure you didn't get any errors in the installation?
 
There is no require statement in the script. I did not get any errors during installation.

The script looks like this(I am using Activestate Komodo and when I run it in debug mode, it shows 'Compilation failed in require for Use statement) :

use Win32::EventLog;

chdir("c:/perl");
$handle=Win32::EventLog->new("System", $ENV{ComputerName})
or die "Can't open Application EventLog\n";
$handle->GetNumber($recs)
or die "Can't get number of EventLog records\n";
$handle->GetOldest($base)
or die "Can't get number of oldest EventLog record\n";


while ($x < $recs) {
$handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
$base+$x,
$hashRef)
or die &quot;Can't read EventLog entry #$x\n&quot;;
if ($hashRef->{Source} eq &quot;EventLog&quot;) {
Win32::EventLog::GetMessageText($hashRef);
print &quot;Entry $x: $hashRef->{Message}\n&quot;;
}
$x++;
}


 
SSG1 - your script works fine on my machine.

Have you considered re-installing Perl and verifying your Win32::EventLog installation? (using ppm) Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
I verified the installation using ppm and it seems to be up to date.
What else could I be missing? I have had no problem with any other module except this one.

Thanks
 
I am using Perl v5.6.1 build 631 (taken from Perl -v) what are you using? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
I am using perl version 5.6.1 build 630.
I will download 631 and try with that.

Thanks
 
I downloaded build 631 and installed it.
I still get the same error.


 
Great....

I don't really know where to go from there. I would try manually deleting the Win32::EventLog files and re-installing them - that's a bit naff, I know, but I don't have any other suggestions....

I know that 'use' makes use of 'require' to physically read in the modules you're 'use'ing - are these files (Win32::EventLog and everything it depends upon) ok to read? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
If I substitute the use statement with require, I notice that it gives the following error:
Win32::EventLog object version 0.071 does not match $Win32::EventLog::VERSION 0.072 at C:/Perl/lib/DynaLoader.pm line 225.
Compilation failed in require at C:\Perl\eventlog.pl line 3.

Also, on another note if i try to run the program from the DOS prompt: I get the foll program error:
Can't read EventLog entry #

It is somehow not able to read the event log.

Does this make any sense to you ?
When you ran it were you able to see all that had been read from the event log ?

Thanks.
 
Yes, it worked its way through the event log on my machine.

Hmmm - if you change the version number in line 12 of EventLog.pm (change it to 0.071) -- what does it do?

How annoying....
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
I changed the version number in the the EventLog.pm and it works fine from the command prompt. However, I get the same compilation error from Activestate Komodo !!!
 
oh.... LOL!

Well, that's interesting - but it doesn't actually help us any ...

I had a look, by the way, in Dynaloader.pm at the line where it failed on your system. Some comments close to their said that failures would probably be attributed to that section because it was the last but of perl code executed before the module was actually imported - and that the problem in that case would most likely be in the module itself.

A while ago I suggested you try deleting and re-installing Win32::EventLog; did you do that? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Yes, I had deleted and re-installed the Win32::EventLog module but that did not help.

I uninstalled Active State Komodo, PERL and re-installed everything back and that does not help either.

Looks like I am at a dead-end here!!!!!
 
:-( yup....

Try it on a clean machine, if you have one. (I hate this kind of thing) Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Well if it was a *nix machine I would check permissions, then I would check to make sure Win32::Log was in the Perl path, and then I would make sure that Win32::Log didn't have any dependencies, i.e. requires or uses that were missing. Of course, your on windows so I'm not sure if any of this applies. I think my next great adventure is to set up IIS and Perl on W2K and play around with them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top