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

This doesn't seem to have any effect here. I guess this sets the locale for the OLE lookups, but my problem is that the global environment has changed

I've discovered that LC_NUMERIC is being changed, which means that
print "LOCALE " . setlocale(LC_NUMERIC) . "\n"; my $winmgmts = Win32::OLE->GetObject("winmgmts:"); print "LOCALE " . setlocale(LC_NUMERIC) . "\n"; setlocale(LC_NUMERIC, 'C'); print "LOCALE " . setlocale(LC_NUMERIC) . "\n";
prints
LOCALE C
LOCALE German_Germany.1252
LOCALE C
Which answers most of my questions. The issues still bothering me are:
  1. What should I do to avoid this sort of thing in the future (it's already cost myself and my colleagues 3 days)
  2. What other strange global side-effects might Win32::OLE be having?


- Boldra

Replies are listed 'Best First'.
Re^3: Win32::OLE->GetObject("winmgmts:") changes my locale
by Anonymous Monk on Apr 20, 2009 at 13:51 UTC
    grep locale Win32-OLE-0.1709 doesn't show locale being set by default, maybe its an OLE issue (not a Win32::OLE specific)? You can test with vbs
      I'm only getting this behaviour with winmgmts, not with every Win32::OLE->GetObject call, so I'm not surprised there's nothing to find in the source for Win32::OLE. OTOH, I have no idea how OLE works, and I'm a bit surprised that any module can have such wide-reaching effects on perl.

      Anyway, thanks for introducing me the the cpan tools, I hadn't seen them before.


      - Boldra