View on
MetaCPAN
Dave Roth > Win32-EventLog-Message > Win32::EventLog::Message

Download:
Win32-EventLog-Message.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 20000624   Source  

NAME ^

Win32::EventLog::Message - Extension enabling Win32 Perl Event Logs to embed messages.

SYNOPSIS ^

    use Win32::EventLog;
    use Win32::EventLog::Message;
    Win32::EventLog::Message::RegisterSource( 'System', 'My Perl Message Source' );

    $Event = Win32::EventLog->new( 'My Perl Message Source' ) || die;

    $Event->Report( 
        {
            EventID     => EVENT_ID,
            Strings     => "Everything is okay.\nReally, it's okay.",
            EventType   => EVENTLOG_SUCCESS_TYPE,
        }
    );

DESCRIPTION ^

This extension provides a message table for Win32 Event Log entries. With this extension event log source names can be created and used.

FUNCTIONS ^

RegisterSource()

UnRegisterSource()

GetSource()

GetSourceList()

GetEventLogList()

GetEventLogList( [$Machine, ] \@List )

This will populate the specified array with the the list of Event Logs that are available on the specified machine. If no machine is specified the local machine is assumed.

Example:

    GetEventLogList( "\\\server", \@List );
    foreach my $EventLogName ( sort( @List ) )
    {
        print "$EventLogName\n";
    }

Result: Number of Event Logs that are available on the specified machine.

GetSource( $EventLog, $SourceName, \%Config )

This will populate the specified hash with the configuration for the specified registered source name in the specified event log.

Example:

    GetSourceList( 'System', \@List );
    foreach $Name ( sort( @List ) )
    {
        if( GetSource( 'System', $Name, \%Config ) )
        {
            print "$Name message file: $Config{path}\n";
        }
    }

Result: TRUE if successful (and populates the specified hash) otherwise returns FALSE.

GetSourceList( $EventLog, \@List )

This will populate the specified array with a list of source names registered under the specified event log.

Example:

    # This will generate a list of all source names registered
    # under the System log
    $Total = GetSourceList( 'System', \@List );

Result: Total number of registered sources.

RegisterSource( $EventLog [, $SourceName ] )

This registers a new EventLog source name.

Example:

    # This will create a new source name under the System log called
    # "My Perl Source"
    RegisterSource( 'System', 'My Perl Source' );

Returns: TRUE if successful otherwise FALSE.

UnRegisterSource( $EventLog, $SourceName )

This will unregister an event log source name. This will remove the event message source from the Event Log configuration. Any entry in the Event Log that refers to the specified source name will result in an entry log description of something similar to:

    The description for Event ID ( 0 ) in Source ( My Perl Log ) cannot 
    be found. The local computer may not have the necessary registry 
    information or message DLL files to display messages from a remote 
    computer.

Example:

    # This will remove a source name under the System log called
    # "My Perl Source"
    UnRegisterSource( 'System', 'My Perl Source' );

Result: TRUE if successful otherwise FALSE.

syntax highlighting: