On 04/11/2002 20:23:12 Steve Silvers wrote:

>The below snippet gives me the error: "Can't call method Open on an
>undefined value".
>
>#!/Perl
>
>use Win32::Registry;
>
>$reg = $HKLM->Open('SOFTWARE\\Microsoft\\Office');
>


die "Registry open failed: $!, $^E" unless defined $reg;


># print out all subkeys of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office
># and their default values
>
>sub prt {
>print $_[0]->Path,' = ',$_[0]->GetValue(''),"\n";
>}
>
>$reg->FindKey(\&prt);
>
>Any Suggestions?

Yes.
Always, yes ALWAYS check the return value from functions which interact
with the system (i.e. the rest of the world).

--
Csaba Ráduly, Software Engineer                           Sophos Anti-Virus
email: [EMAIL PROTECTED]                        http://www.sophos.com
US Support: +1 888 SOPHOS 9                     UK Support: +44 1235 559933


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to