OK, I've found myself in a situation where I'm required to re-invent the wheel. Perl is the only avenue I have to do that, at this point. I'm running into an issue where the Win32::EventLog module errors out with the following error:
Can't locate object method "new" via package "Win32::EventLog" at myscript.pl line 300.
The line that errors out (300) is as follows:
my $handle = Win32::EventLog->new("$whichlog", $ENV{ComputerName}) or die "Can't open $whichlog EventLog: $! \n";
The above is called from within a subroutine ($whichlog is supplied as an argument), and *appears* to only fail because no "significant" events are contained in the Application log. I've verified this by copying the example from the CPAN doc entry, which, when run on the Application log, produces no events (even though events DO exist). When run on the System log, only startup/shutdown events are listed. The Security log is equally "empty".
When I run the "print_log" script, which basically consists of the example from the POD on CPAN, it works fine (except that there are no events for the Application and Security logs). I don't get the error.
So, why am I getting this error? Win32::EventLog is obviously installed (I'm using the Windows version of ActivePerl v5.8.8 - Win32::EventLog is part of libwin32 as of 2002). If it's a bug with Win32::EventLog, I'd like to be able to error "gracefully" if there are no events, but it's rather curious that there ARE events in the binary log, but nothing is produced from the text output.
I'm happy to provide more info if I haven't provided enough here. Thanks in advance for your great wisdom. ;-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.