Skip Menu |

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 57934
Status: resolved
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: kmx [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: 5.12.1.0.beta_1 - update_env.pl (no re-login)
Cusrtis,

Just to keep a record of our e-mail communication:

The problem with relogin-neede after setting ENV variables via registry is in fact a feature, see http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx - quote:

To programmatically add or modify system environment variables, add them to the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE message with lParam set to the string "Environment".

and solution here: http://www.perlmonks.org/?node=171505

it works like this:

Show quoted text
#####################
use Win32::API;
use constant HWND_BROADCAST => -1;
use constant WM_SETTINGCHANGE => 0x1a;

... here set proper registry values ...

my $SendMessage = new Win32::API("user32", "SendMessage", 'NNNP', 'N') or die "Couldn't create SendMessage: $!\n";
my $RetVal = $SendMessage->Call(HWND_BROADCAST,WM_SETTINGCHANGE,0,'Environment');
Show quoted text
#####################

You have to open a new command prompt but no need to re-login

The side effect is that we need to include Win32::API module into strawberry release.

--
kmx
It IS in 32-bit, as for 64-bit, we're stalled against https://rt.cpan.org/Ticket/Display.html?id=42685 and https://rt.cpan.org/Ticket/Display.html?id=42685 . SO I can't use it YET. Specifying "stalled" for now until those two bugs are fixed.