Ok, this is a bit odd ... it took me a few hours to figure out why this didn't work:

my $s = do { # don't care about warnings. local *STDERR; open STDERR, '>', File::Spec->devnull(); code_that_warns_deep_in_core_perl(); # and I can't figure out why };
The warning still showed. Yet if I ran the script as perl ./x.pl 2> /dev/null, well, it didn't show up. So no one is reopening anything, as my first guess supposed... and then I realised that it wasn't the warning (since a small test script didn't exhibit the same problem), but that I use diagnostics. It's only the diagnostics that show up. Ugh.

So, first question: does anyone else consider it a bug that the above doesn't DWIM when using diagnostics?

Second question is ... has anyone had any problems with codepage conversions causing:

Use of uninitialized value in lc at /usr/lib/perl5/5.8.7/utf8_heavy.pl line 123.
(That's the line that says:
if (my $base = ($utf8::Canonical{$canonical} || $utf8::Canonical{ lc $ +utf8::PropertyAlias{$canonical} })) {
) I haven't been able to pare it down, unfortunately, to a smaller working example. The idea is that I'm reading some XML files (XML::Twig), getting the text from there, and then doing some funkiness with the text to modify it based on data I get from elsewhere. I split the text using a reasonably complex regexp (for a split, anyway), and then I uc some of it. This, apparently, causes perl to go into utf8_heavy's utf8::SWASHNEW method where it tries to lc something that I don't get.

I've even tried to use Encode::decode to decode the UTF-8 from the XML file, but no change in behaviour (that I've noticed) there. Any clues would be appreciated. Meanwhile, I'm going to continue trying to pare down to a minimal-working example that gets the same error.


In reply to diagnostics, STDERR, and codepage conversions by Tanktalus

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.