Hi, I use the WIn32::Eventlog module to dump on a file the logs of the applications(cygwin tftpd ftpd). Then I parse this file to display some of theses informations in a HMI. My problem is that when i run my application i must clean all entries on Application in the NT Eventlog because if i don't my applications makes the PC "extra working" and it frezzes my perl tk app because there is so much events in the Applications NT Eventlog. But cleaning at init it is quite annonying because some precious informations are lost. How can i do to avoid this and for exemple to dump to my file only if a new event comes.Thanks. My code:
open (READ,"$_Globals{TIME}")or die "Can't open READ: $!\n"; $timewritten = <READ>; close (READ) or die "Can't close READ: $!\n"; $x = 0; use Win32::EventLog; $handle=Win32::EventLog->new("Application") or die "Can't open Application EventLog\n"; $handle->GetNumber($recs) or die "Can't get number of EventLog records\n"; #print "No. of records = $recs\n"; $handle->GetOldest($base) or die "Can't get number of oldest EventLog record\n"; #print "Oldest record is record no. $base\n"; # To append: open (LOGFILE,">>$CMPath/cygwin_syslog.txt") or die "Can't open LOGFILE: $!\n"; foreach (0 .. $recs - 1) { $handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ, $base+$_, $hashRef) or die "Can't read EventLog entry #$x\n"; %deref = %$hashRef; # Next line is new ##### next if ($timewritten > $deref{TimeGenerated}); foreach (qw{Cygwin dhcpd tftpd ftpd}) { if ($deref{Source} eq $_) { if ($timewritten < $deref{TimeGenerated}) { print LOGFILE "$deref{TimeGenerated}: $deref{Strings} ($_)\n"; } } } # Next 2 lines are new ##### $time = $deref{TimeGenerated} if ($time < $deref{TimeGenerated}); } close (LOGFILE) or die "Can't close LOGFILE: $!\n"; # Next 3 lines are new ##### open (WRITE, ">$_Globals{TIME}") or die "Can't open WRITE: $!\n"; print WRITE $time; close (WRITE) or die "Can't close WRITE: $!\n"; _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs