The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Win32::Registry - accessing the Windows registry [obsolete, use Win32::TieRegistry]

SYNOPSIS

use Win32::Registry;
my $tips;
$::HKEY_LOCAL_MACHINE->Open("SOFTWARE\\Microsoft\\Windows"
                           ."\\CurrentVersion\\Explorer\\Tips", $tips)
    or die "Can't open tips: $^E";
my ($type, $value);
$tips->QueryValueEx("18", $type, $value) or die "No tip #18: $^E";
print "Here's a tip: $value\n";

DESCRIPTION

NOTE: This module provides a very klunky interface to access the
Windows registry, and is not currently being developed actively.  It
only exists for backward compatibility with old code that uses it.
For more powerful and flexible ways to access the registry, use
Win32::TieRegistry.

Win32::Registry provides an object oriented interface to the Windows Registry.

The following "root" registry objects are exported to the main:: name space. Additional keys must be opened by calling the provided methods on one of these.

$HKEY_CLASSES_ROOT
$HKEY_CURRENT_USER
$HKEY_LOCAL_MACHINE
$HKEY_USERS
$HKEY_PERFORMANCE_DATA
$HKEY_CURRENT_CONFIG
$HKEY_DYN_DATA

Methods

The following methods are supported. Note that subkeys can be specified as a path name, separated by backslashes (which may need to be doubled if you put them in double quotes).

Open
$reg_obj->Open($sub_key_name, $sub_reg_obj);

Opens a subkey of a registry object, returning the new registry object in $sub_reg_obj.

Close
$reg_obj->Close();

Closes an open registry key.

Connect
$reg_obj->Connect($node_name, $new_reg_obj);

Connects to a remote Registry on the node specified by $node_name, returning it in $new_reg_obj. Returns false if it fails.

Create
$reg_obj->Create($sub_key_name, $new_reg_obj);

Opens the subkey specified by $sub_key_name, returning the new registry object in $new_reg_obj. If the specified subkey doesn't exist, it is created.

SetValue
$reg_obj->SetValue($sub_key_name, $type, $value);

Sets the default value for a subkey specified by $sub_key_name.

SetValueEx
$reg_obj->SetValueEx($value_name, $reserved, $type, $value);

Sets the value for the value name identified by $value_name in the key specified by $reg_obj.

QueryValue
$reg_obj->QueryValue($sub_key_name, $value);

Gets the default value of the subkey specified by $sub_key_name.

QueryKey
$reg_obj->QueryKey($classref, $number_of_subkeys, $number_of_values);

Gets information on a key specified by $reg_obj.

QueryValueEx
$reg_obj->QueryValueEx($value_name, $type, $value);

Gets the value for the value name identified by $value_name in the key specified by $reg_obj.

GetKeys
my @keys;
$reg_obj->GetKeys(\@keys);

Populates the supplied array reference with the names of all the keys within the registry object $reg_obj.

GetValues
my %values;
$reg_obj->GetValues(\%values);

Populates the supplied hash reference with entries of the form

$value_name => [ $value_name, $type, $data ]

for each value in the registry object $reg_obj.

DeleteKey
$reg_obj->DeleteKey($sub_key_name);

Deletes a subkey specified by $sub_key_name from the registry.

DeleteValue
$reg_obj->DeleteValue($value_name);

Deletes a value identified by $value_name from the registry.

Save
$reg_obj->Save($filename);

Saves the hive specified by $reg_obj to a file.

Load
$reg_obj->Load($sub_key_name, $file_name);

Loads a key specified by $sub_key_name from a file.

UnLoad
$reg_obj->Unload($sub_key_name);

Unloads a registry hive.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 210:

=over without closing =back