Using Cygwin Perl v5.8.8 and Win32::TieRegistry 0.26.
We can get a tied hash object thing for HKEY_CURRENT_USER:
$ perl -e '
my %RegHash;
use Win32::TieRegistry( TiedHash => \%RegHash );
use Data::Dumper;
my $Key = $RegHash{"HKEY_CURRENT_USER"};
print Dumper $Key;'
$VAR1 = bless( {}, 'Win32::TieRegistry' );
And this works for sub keys:
$ perl -e '
my %RegHash;
use Win32::TieRegistry( TiedHash => \%RegHash );
use Data::Dumper;
my $Key = $RegHash{"HKEY_CURRENT_USER\\Software"};
print Dumper $Key;'
$VAR1 = bless( {}, 'Win32::TieRegistry' );
And we can print information for the key:
$ perl -e '
my %RegHash;
use Win32::TieRegistry( TiedHash => \%RegHash );
use Data::Dumper;
my $Key = $RegHash{"HKEY_CURRENT_USER\\Software"};
print Dumper $Key->Information;'
$VAR1 = 'CntSubKeys';
$VAR2 = 48;
$VAR3 = 'MaxSubClassLen';
$VAR4 = 21;
...
However the documentation implies we can list the sub keys simply by treating it as a hash:
$ perl -e '
my %RegHash;
use Win32::TieRegistry( TiedHash => \%RegHash );
use Data::Dumper;
my $Key = $RegHash{"HKEY_CURRENT_USER\\Software"};
print Dumper keys %$Key; '
But the array is empty. Is it broken or am I doing something wrong? Is there another way to list the sub keys?
This doesn't work either:
$ perl -e '
my %RegHash;
use Win32::TieRegistry( TiedHash => \%RegHash );
use Data::Dumper;
my $Key = $RegHash{"HKEY_CURRENT_USER\\Software"};
print Dumper $Key->SubKeyNames;'
Can't use an undefined value as an ARRAY reference at
/usr/lib/perl5/vendor_perl/5.8/cygwin/Win32/TieRegistry.pm line 720.