rut has asked for the wisdom of the Perl Monks concerning the following question:

$winkey= $Registry-> {"CUser/Software/Microsoft/Internet Account Manager/"};
The above code will not work. The spaces in "Internet Account Manager" seems to be the problem. Im running XP with NTFS and Apache webserver and ActivePerl. Anyone knows what to do? tnx

Edit by castaway - added code tags

Replies are listed 'Best First'.
Re: problem with spaces in path to registry key
by inman (Curate) on Jun 25, 2004 at 10:54 UTC
    The following works just fine on a Windows XP machine. The spaces are not an issue. I am running this as an administrator from a command line. Check out the security permissions on the registry keys that you are wanting to read. This is even more important if you are using the code from a web server.

    #! /usr/bin/perl -w use strict; use warnings; my $Registry; use Win32::TieRegistry 0.20 ( TiedRef => \$Registry, Delimiter => "/", ArrayValues=>1, qw( REG_SZ REG_EXPAND_SZ REG_DWORD REG_BINARY REG_MULTI_SZ KEY_REA +D KEY_WRITE KEY_ALL_ACCESS ), ); my $winkey= $Registry->{"CUser/Software/Microsoft/Internet Account Man +ager/"}; print keys(%$winkey);

      If you had included

      or die "Can't open InetAcctMgr: $^E";

      then rut might get told why the open is failing rather than you trying to guess. (:

      - tye        

Re: problem with spaces in path to registry key
by davidj (Priest) on Jun 25, 2004 at 08:32 UTC
    Three questions:

    1) What do you mean "it doesn't work"? You really need to be more specific.
    2) What are you trying to do with the code?
    3) What kind of object is $Registry. (I assume it is a win32::Registry object, but there is no way to tell by the code you have provided.

    Answer these questions and I'm sure assistance will come your way.

    davidj