Of course, you have to check the case on ALL your function 
calls and constants, in the whole length of the script.
Eventtype is EventType, etc. 
Cross check with the documentation for proper spelling. 
Errors displayed as 'possible typo' are usually just that. 

_____________________________________________
Bruno Bellenger
Sr. Network/Systems Administrator 


        -----Original Message-----
        From:   Mike Singleton [SMTP:[EMAIL PROTECTED]]
        Sent:   Friday, August 30, 2002 3:58 PM
        To:     [EMAIL PROTECTED];
[EMAIL PROTECTED]
        Subject:        RE: eventlog script help

        Same error.... hmmm.. does running under XP or Win2k make any
difference?

        >>> "Bellenger, Bruno (Paris)" <[EMAIL PROTECTED]>
08/30/02 06:38AM >>>
        use  Win32::EventLog, not Win32::Eventlog
        _____________________________________________
        Bruno Bellenger
        Sr. Network/Systems Administrator 


                -----Original Message-----
                From:   Mike Singleton [SMTP:[EMAIL PROTECTED]] 
                Sent:   Friday, August 30, 2002 3:14 PM
                To:     [EMAIL PROTECTED] 
                Subject:        eventlog script help

                Error:Name "main::Eventype" used only once: possible typo at
H:\perl
        scripts\wmitimed.pl line 20.
                Name "Win32::Eventlog::GetMessageText" used only once:
possible typo
        at H:\perl scripts\wmitimed.pl line 3.
                Can't call method "GetNumber" on an undefined value at
H:\perl
        scripts\wmitimed.pl line 11.
                Process terminated with exit code 0

                ====Code =======
                use Win32::Eventlog;
                # Enable message retrieval
                $Win32::Eventlog::GetMessageText = 1;
                my $SecPerWeek = 7 * 24 * 60 * 60;
                my $Now = time ();
                my $WeekAgo = $Now - $SecPerWeek;
                my $Num;
                my $Event - new Win32::EventLog( "System", "" )
                            or die " Unable to open eventlog. \n " ;
                $~ = "Event_Message";
                if( $Event->GetNumber( $Num ) )
                {
                    my $Flag = EventLog_Backwards_Read |
Eventlog_Sequential_Read;
                    my %Hash;
                    my $fContinue = 1;
                    do
                {
                    if  ( $Event->Read( $Flag, 0, \%Hash ) )
                    {
                        if ( $Hash {$Eventype} == Eventlog_Error_Type )
                        {
                            local $Message = $Hash{Message} || "No Message";
                            print "$Hash{Source} on $Hash{Computer}
indicated an
        error ";
                            print " at " . localtime( $Hash{TimeGenerated} )
. "
        .\n";
                            write;
                            print "\n";
                        }
                    }
                    else
                    {
                        $fContinue = 0;
                    }
                    } while ($WeekAgo < $Hash{TimeGenerated} && $fContinue
);
                    Win32::EventLog::CloseEventLog( $Event->{handle} );
                }

                format EVENT_MESSSAGE=

                            Message:
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                $Message
                    ~
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                $Message
                    ~
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                $Message
                    ~
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                $Message
                    ~
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                $Message
                    ~
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                $Message
                    ~
        ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                .

                ==== End Code ====

                ===
                Mike Singleton 
                Network Analyst
                (253) 272-1916  x1259
                (253) 405-1968 (cellular)
                [EMAIL PROTECTED] 

                DaVita Inc.
                _______________________________________________
                Perl-Win32-Admin mailing list
                [EMAIL PROTECTED] 
                To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs 

        _______________________________________________
        Perl-Win32-Admin mailing list
        [EMAIL PROTECTED] 
        To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

        DaVita Inc.
        _______________________________________________
        Perl-Win32-Admin mailing list
        [EMAIL PROTECTED]
        To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to