I am having trouble getting the correct Event ID to print when using the Win32::EventLog module.
This code sample is trying to print the Event ID values for the first 5 events in the System log.
My output is
-2147480614
-2147480614
-2147480614
1073741850
-2147477643
The actual Event IDs are
3034
3034
3034
26
6005
What am I doing wrong here? I think it has something to do with signed vs. unsigned integers, but
I cannot figure out where the problem is.
#!c:\perl\bin\perl -w
use strict;
use Win32::EventLog;
my %Event;
my $EventLog = "System";
my $EventHandle;
my $Flags = EVENTLOG_BACKWARDS_READ | EVENTLOG_SEQUENTIAL_READ;
$Win32::EventLog::GetMessageText = 1;
$EventHandle = Win32::EventLog->new( $EventLog, "" ) || die "Unable to open $EventLog event log. $!\n";
for(my $i=0;$i<5;$i++)
{
$EventHandle->Read( $Flags, 0, \%Event );
print "$Event{EventID}\n";
}
$EventHandle->Close;
Thanks for the help,
Bill Young
- RE: Printing Event ID using Win32::Eventlog William . Young
- RE: Printing Event ID using Win32::Eventlog Scott Campbell
