How about this:
use Win32::TieRegistry( Delimiter=>"\\", ArrayValues=>0 );
$regstr="\\\\computername\\HKEY_LOCAL_MACHINE\\Software\\"; # remember the trailing
\\ !
$RegObj=$Registry->{$regstr};
if (exists($regobj->{"SubKeyName\\"}))
{
# Play with sub keys here...
}
if (exists($regobj->{"\\ValueName"}))
{
# read in values here...
}
HTH :)
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
Keith Paschal
Sent: Tuesday, November 04, 2003 3:21 PM
To: [EMAIL PROTECTED]
Subject: finding if a key exists
Folks;
I'm writing a bit of code to determine if specific software is installed on
a windows system. What I'm looking for is a specific key named "Version"
under a hive: "SOFTWARE\\VENDOR\\PRODUCT" but I've found out that this
product, when uninstalled, leaves the hive (I hope I'm using the right word
here) there, but removes all keys from that hive. (E.g. the
SOFTWARE\\VENDOR\\PRODUCT still exists with nothing underneath)... when I
use getKeys to get a listing to pattern match for "Version", I get an error:
Can't call method "GetValues" on an undefined value at
C:\scripts\reglist.ovpl line 19.
Is there a "exists" type function for the Win32::Registry perl module that I
can use to test if the key "Version" exists before trying to open it?
Thanks;
Keith
_________________________________________________________________
Crave some Miles Davis or Grateful Dead? Your old favorites are always
playing on MSN Radio Plus. Trial month free!
http://join.msn.com/?page=offers/premiumradio
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs