Skip Menu |

This queue is for tickets about the Win32-EventLog-Carp CPAN distribution.

Report information
The Basics
Id: 42116
Status: new
Priority: 0/
Queue: Win32-EventLog-Carp

People
Owner: Nobody in particular
Requestors: martinbertolino [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 1.42



A very simple modifications that I made so it properly logs to the Windows Event log without getting the message: "The description for Event ID ( 0 ) in Source ( script.pl ) could not be found. It contains the following insertion string(s): Hello at script.pl line 10." and also not requiring the module Win32::EventLog::Message which does not seem to be actively maintained and it is almost impossible to build from source. I'm not a Perl/XS expert but I spent over 10 hours today trying to get it to build on Vista/VS2008/ActivePerl 5.10 and did not get anywhere. The change I made takes advantage of the fact that ActivePerl registers a Windows event source named PerlMsg.dll. In searching the web I found that it supports an event Id 0xC0000004 that takes one string argument (http://www.mail- archive.com/activeperl@listserv.activestate.com/msg13808.html) So if you make the following changes to Carp.pm (3 lines): >diff lib\Win32 \EventLog\Carp.pm Carp.pm.orig 27c27 < my ( $EventLogHandle, $Source, $SourceFileName, $Register, $EventID ); --- Show quoted text
> my ( $EventLogHandle, $Source, $SourceFileName, $Register );
41d40 < $EventID = $_->{EventID}; # EventID to use when reporting to the event log 137c136 < EventID => $EventID, --- Show quoted text
> EventID => 0, and then you import it this way (when using
ActiveState): use Win32::EventLog::Carp { Register => 0, Source=>"PerlMsg", EventID => 0xC0000004 }; It properly formats the events in the Windows event log. I have attached the modified Carp.pm that I downloaded from cpan (version 1.42). I'm not a usual user of Perl but I'm having to port a web application from OSX/Apache to Windows Server 2003/IIS and needed something to easily be able to send messages to the windows event log and not lose them in stderr. You module Win32::EventLog::Carp fits the bill exactly but I'm not sure what is the best approach to contribute back these changes, if you think they are worthwhile.

Message body is not shown because it is too large.