in reply to Re: how do you propagate Tie::Registry modifications to the system environment
in thread how do you propagate Tie::Registry modifications to the system environment

Thanks for the info on Win32::Env and the Broadcast function. It seems to do the trick most of the time.

We are trying to use the Win32::Env Broadcast function. It seems to work fine in most cases.

We have found one machine where the function hangs. It has been trying for 8 minutes now and will not complete.

The test case we are using is with perl version 5.8.8 822 from activestate. I installed Win32::Env 0.03 a few weeks ago.

This is the script we are trying. It failed in a much larger script and we found this fails also.

use Win32:Env;
Broadcast();

Do you know why this might happen? It there some sort of debug that can be enabled to see what it is trying to do?

  • Comment on Re^2: how do you propagate Tie::Registry modifications to the system environment

Replies are listed 'Best First'.
Re^3: how do you propagate Tie::Registry modifications to the system environment (UtS,L)
by tye (Sage) on Aug 14, 2010 at 06:02 UTC

    Do you even glance at the source code? (http://cpansearch.perl.org/src/ROWAA/Win32-Env-0.03/lib/Win32/Env.pm) BroadcastEnv() is extremely simple. It boils down to the equivalent of:

    SendMessage( HWND_BROADCAST, WM_SETTINGCHANGE, 0, "Environment" );

    If you want to debug that, you should probably use something like Spy++ (part of Visual Studio).

    It taking a long time probably means that you have a service or similar process that is hung.

    - tye        

      My problem is it is not just me. I have several hundred people in multiple states and countries using the code. Randomly we have a machine that hangs and then the user install will fail.

      I was hoping that this problem may have been seen and understood some time in the past.

      What we don't understand is why the "setx" command will always work when the Broadcast() fails. There must be something Microsoft does with "setx" that is different then the module. My hope would be that this could be figured out and fixed so others don't have problems.

      We have found some talk about Google Desktop and a service called NMIndexingService (part Nero software) being culprits in this hang.

        So you still haven't glanced at the code?

        It contains a comment noting a wish to use a slightly different call that includes a time-out.

        - tye