Win32::TieRegistry::Dump - dump Win32 registry tree


Win32-TieRegistry-Dump documentation Contained in the Win32-TieRegistry-Dump distribution.

Index


Code Index:

NAME

Top

Win32::TieRegistry::Dump - dump Win32 registry tree

SYNOPSIS

Top

	use Win32::TieRegistry::Dump
	$_ = Win32::TieRegistry::Dump::toArray ("LMachine/Software/LittleBits/");
	while (my ($key, $value) = each %{$_} ){
		warn "$key = $value\n";
	}
	exit;

FUNCTION toArray

Top

Returns a reference to a hash of values in a Win32 registry tree, keyed by registry entry.

FUNCTION toArray

Top

Returns an array of keys and values in a Win32 registry tree.

DEPENDENCIES

Top

	Win32::TieRegistry

EXPORTS

Top

None.

AUTHOR

Top

Lee Goddard <http://www.leegoddard.com/> Mailto: <lgoddard -at- cpan -dot- org>

LICENCE AND COPYRIGHT

Top

SEE ALSO

Top

See Win32::TieRegistry; Win32::TieRegistry::PMVersionInfo;


Win32-TieRegistry-Dump documentation Contained in the Win32-TieRegistry-Dump distribution.
package Win32::TieRegistry::Dump;
our $VERSION = 0.031;	# Bug fix by sb@engelschall.com &


use 5.006;
use strict;
use Carp;
use Win32::TieRegistry ( Delimiter=>"/", ArrayValues=>0 );
no strict 'refs';

sub toHash {
	my $literal = shift or carp __PACKAGE__."::toArray requires an argument" and return undef;
	my $rkey = $Registry->{$literal}
		or  warn "* Can't read the registry key for $literal:\n $^E\n" and return undef;
	return &_iterate ($rkey,$literal);
}

sub toArray {
	my $literal = shift or carp __PACKAGE__."::toArray requires an argument" and return undef;
	my $rkey = $Registry->{$literal}
		or  warn "* Can't read the registry key for $literal:\n $^E\n" and return undef;
	$_ = &_iterate ($rkey,$literal);
	@_ = ();
	foreach my $i (keys %$_){
		push @_, "$i/$_->{$i}";
	}
	return @_;
}

sub _iterate { my ($key,$root) = (shift,shift);
	my $info = shift  || {};
	foreach my $entry (  keys(%$key)  ) {
		if ($key->SubKeyNames){
			&_iterate( $key->{$entry}, $root.$entry, $info );
		} else {
			$info->{$root.$entry} = $key->{$entry};
		}
	}
	return $info;
}



1; # Return cleanly from module