in reply to Re^6: How to open SQL 2005 errorlog?
in thread How to open SQL 2005 errorlog?

Essentially, it's as easy as replacing the open(...) with open_bom(LOG, $sqlErrorlog), the only 'challenge' being that you need to modify your error handling slightly (as open_bom() will croak in case of an error). But something like this should do the trick:

use File::BOM 'open_bom'; # ... eval { open_bom(LOG, $sqlErrorlog) }; if ($@) { $ref->{log_open_error} = "***Error: $@"; # don't know what Win32::GetLastError would do here # just try it, if you really need it... # $ref->{log_open_error} .= Win32::FormatMessage(Win32::GetLastErr +or); return $ref; }

File::BOM depends on Readonly, so you want to install that module too (unless you already have it). As both modules are pure Perl, there shouldn't be any problems getting them installed.

Cheers,
Almut

Replies are listed 'Best First'.
Re^8: How to open SQL 2005 errorlog?
by jc7 (Initiate) on Jun 12, 2007 at 16:35 UTC
    Cheers! It works! Thanks you very very much!!!