in reply to Re: Win32::OLE->GetObject("winmgmts:") changes my locale
in thread Win32::OLE->GetObject("winmgmts:") changes my locale

Hi ww,

while the machine in question is in Germany, the problem is that perls behaviour is changing at runtime as a side-effect of doing an OLE-lookup.

This isn't what the customer wants, and certainly isn't what I want. It doesn't even match the documentation for locale (Category LC_NUMERIC: Numeric Formatting), which should only change print, and not the parsing of strings. In my case I'm also having problems because of code like the following:
my $foo = '7.5'; # a string my $winmgmts = Win32::OLE->GetObject("winmgmts:"); #spooky action-at-a +-distance $foo < 7.5 and die("version too old"); #dies here!



- Boldra

Replies are listed 'Best First'.
Re^3: Win32::OLE->GetObject("winmgmts:") changes my locale
by Corion (Patriarch) on Apr 20, 2009 at 13:43 UTC

    Did you set your locale at the start of your program? perllocale says you should/have to declare the locale at program startup. Maybe that would prevent the locale getting set from elsewhere. Otherwise, you'll have to save/restore the locale around all calls to Win32::OLE :-/

      Hi Corion,

      thanks for your suggestion, I admit I am guilty of never giving this any thought, but in this case it still doesn't help. Even if I explicitly set LC_NUMERIC at the start of my program it gets overwritten by the GetObject call.


      - Boldra