TieRegistry is a nice package.... but while your changes will persist in the current shell and for child processes, they do not propogate to the parent process, nor do they persist from session to session.
behold! the answer! We need to “broadcast to other Win32 processes a message to reload their environment”
It works! OtherMichael June 02, 2010, at 05:20 PM
I needed this to change the PATH programmatically for FW, to switch between the dev and test environments.
use constant HWND_BROADCAST => 0xFFFF;
use constant WM_SETTINGCHANGE => 0x001A;
my $SendMessage = Win32::API->new("user32", "SendMessage",
[qw(N N P P)], "N");
my $result = $SendMessage
->Call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment');