From: [EMAIL PROTECTED]
> I am trying to update the Registry using a script from
> David Roth's book Win32 Perl Programming. The script
> appears to run, no errors, however the Key does not get
> added to the registry.
>
> Any help is appreciated.
>
> Thanks
You want to test for errors and print error messages if something
doesn't succeed :
#!/perl/bin/perl -w
use strict;
use Win32::Registry;
my $Path = 'Software\Microsoft\Office\9.0\Word\OptionsX';
my $ValueName = "AutoSave-Path";
my $Key;
$HKEY_CURRENT_USER ->Open($Path, $Key)
or die "Can't open $Path : $^E\n";
my($DataType, $Data);
$Key->QueryValueEx($ValueName, $DataType, $Data)
or die "Can't get the value of $ValueName : $^E\n";
die "The value was not set!\n"
unless defined $Data;
if ((REG_SZ == $DataType) || (REG_EXPAND_SZ == $DataType)) {
#$Data =~ s/^c:/d:/i;
$Key->SetValueEx($ValueName, 0, REG_DWORD, 1)
or die "Can't change the value of $ValueName : $^E";
}
__END__
You may also want to install
http://Jenda.Krynicky.cz/#Win32::Registry2
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]