Mike Mercier wrote:

> Hi,
> 
> Is the script below correct?  It works as expected, except I get the error:
> Use of uninitialized value in unpack at
> C:/Perl/site/lib/Win32/EventLog.pm line 130.
> It seems to be trying to read an event after the last has been read.
> 
> Either I have done something wrong, or Win32::EventLog should do:
> 
> sub Read {
>     my $self = shift;
> 
>     die "usage: OBJECT->Read(FLAGS, RECORDOFFSET, HASHREF)\n" unless @_ == 3;
> 
>     my ($readflags,$recordoffset) = @_;
>     # The following is stolen shamelessly from Wyt's tests for the registry.
>     my $result = ReadEventLog($self->{handle}, $readflags, $recordoffset,
>                             my $header, my $source, my $computer, my $sid,
>                             my $data, my $strings);
>     # insert this
>     if ($result) {
>         my ($length,
>       $reserved,
>       $recordnumber,
>         .... continue with rest of code
>     }
> 
>     return $result;
> }

Maybe instead change:
        $dataoffset) = unpack('l6s4l6', $header);
to
        $dataoffset) = unpack('l6s4l6', $header) if $header;


Or you could even fake a null result for $header rather than undef:

        $dataoffset) = unpack('l6s4l6', $header || "\000" x 56);

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to