in reply to TieRegistry problem...environment option ?

From the Win32API::Registry documentation (the module that Win32::TieRegistry is built upon):

All calls return a true value for success and a false value for failure. After any failure, $^E should automatically be set to indicate the reason. However, current versions of Perl often overwrite $^E too quickly, so you can use regLastError() instead, which is only set by Win32API::Registry routines.
The error message that Perl most often overwites $^E with is "The system could not find the environment option that was entered".

Unfortunately, I haven't updated Win32::TieRegistry to document this nor to allow you to do use Win32::TieRegistry ( Delimiter=>"/", 'regLastError' ); so you'll have to add use Win32API::Registry qw( regLastError ); to your script and replace $^E with regLastError(). That will probably shed some light on the problem. If you have an old copy of Win32API::Registry, then you might have to update it.

I'd guess you are having a permissions problem. Win32::TieRegistry will try to open the key for read and write access and perhaps you only have read access (old versions of the module try to open keys for "all" access). You can try requesting read-only access instead (let us know if you have problems doing that).

A future version of TieRegistry will instead have a list of "open permissions" that defaults to ( "all", "read+write", "read-only" ) and will try those modes in sequence and only fail to open if all three attempts fail.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: TieRegistry problem...environment option ?
by uzzikie (Sexton) on Jul 19, 2001 at 05:04 UTC
    hi tye

    thanks for ur help.....
    regLastError() did indeed report a more meaningful error being

    Access Denied

    I had wanted the script to read one of the sub keys in LMachine/Software but proper permissions (full control)were set for the sub keys ONLY
    thus when the script tried to read LMachine/Software it said access denied.

    Subsequently I made the script read the subkey directly
    <code>$swKey= $Registry->{"LMachine/Software/Subkey1/Subkey2/"}<code>
    and this solved the problem..

    thanks again for all ur help guys...