At perlclib Tk is explicitly mentioned. The discussion there and what I'm about to write are more at the C level than the Perl level.

Every C program, which the Perl interpreter is written in has a set of underlying locale categories. There is a category for the monetary system, another for the decimal point character, and several others. These need not be consistent. I know a person who grew up in the English speaking portion of Canada, now living in Amsterdam, who has his locales set to use Dutch currency, postal addresses, paper sizes, etc, but English as the language, and probably a dot as the decimal point.

In a pure Perl program, the interpreter performs various locale services for you. One of those is to isolate you from the underlying C locale except when you explicitly say you want to use it, or for a few functions in the POSIX module that are pretty direct pipelines to the underlying C library functions. Windows is not POSIX compliant; I can't remember which of those functions are available in Strawberry, but this is a side note anyway to the main discussion.

You explicitly tell Perl to use the locale by being in the lexical scope of a 'use locale' statement. Only then do you have to worry about getting a comma versus a dot for the decimal point.

But when you call any module that isn't also in pure Perl, you are at their mercy for locale handling. Tk is such a module. Until 5.40, the guidance for module authors was not very good. But I undertook to change that by adding extensively to perlclib linked to above. (Patches/improvement suggestions welcome.)

Earlier than 5.32, I added functions to the Perl C language API with Tk in mind so that a module that is playing around with locales can take control from perl, and when done, return it. Previously both Perl and Tk thought they were the sole masters of locales; the resulting tug of war tended to end badly. I think Tk changed to use these. Newer versions of Tk allow it to not consider itself the master. Maybe doing that would fix your issue. But when a module does have control, Perl can't be doing its normal locale services for you. So you may be exposed to a comma, depending on the locale and module's code

If you do end up having to set the locale, it is slightly better to use C instead of some English one; that will execute things somewhat faster


In reply to Re^4: Strawberry 5.40 Tk affects floating point comma separator by khw
in thread Strawberry 5.40 Tk affects floating point comma separator by olgo

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.