http://qs321.pair.com?node_id=858269


in reply to Re: Unable to delete registry keys using Win32::TieRegistry
in thread Unable to delete registry keys using Win32::TieRegistry

Just don't leave off the trailing '/'. All of the other changes you made probably have no bearing on the problem. In particular, your use of Open() probably makes no difference.

If you leave off the trailing '/', then the module must try to guess whether you mean to delete a value or to delete a subkey. The logic to detect which seems the likely intent is more fragile and likely fails in this particular case.

- tye        

  • Comment on Re^2: Unable to delete registry keys using Win32::TieRegistry ('/')

Replies are listed 'Best First'.
Re^3: Unable to delete registry keys using Win32::TieRegistry ('/')
by liverpole (Monsignor) on Sep 01, 2010 at 03:53 UTC
    Thanks for your answer.  I was kind of hoping you might comment here, since it appears you wrote the original module, and it's nice to get advice directly from the expert.

    I don't think I was missing a trailing '/' in my original code, but now I'm not sure; it's certainly possible.  I'll have to go back and check tomorrow.  

    Since I have your ear, (more accurately "eyes"), is there any easy way to delete a whole subkey, which may or may not have subkeys or subvalues?  From what I've read of the documentation there's no way to do so, (and I've already written code that seems to work for this), but it seems like a potentially useful option.

    It's a very useful module!  I've got some ideas for things I'd like to add to the Windows context menu, and this seems just the I need to automate it. :-)


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
      [...] is there any easy way to delete a whole subkey, which may or may not have subkeys or subvalues?

      My answer at Re: Removing keys in the registry (code) has not lost what accuracy it started out with so I'll just stop with the link to it.

      - tye