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
|