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


In reply to Re^7: How to open SQL 2005 errorlog? by almut
in thread How to open SQL 2005 errorlog? by jc7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.