anadem has asked for the wisdom of the Perl Monks concerning the following question:
Unfortunately I'm too dumb to get it to work. In my code, when deleting a reg value (not key) the delete operation either deletes the value and returns its data, or, when the value is not in the registry the delete fails and returns a string "The system cannot find the file specified."".. by calling the FastDelete member function: # # $prevSetting= $regKey->FastDelete(1); # # which will cause all subsequent delete operations via $regKey to sim +ply return a true value if they succeed.
Can some kind monk please point out the error of my ways?
Here's a simple sample:
Those docs go on to say "This optimization is automatically done if you use delete in a void context."use Win32::TieRegistry( Delimiter=>"/", ArrayValues=>1 ); $key = "LMachine/Software/Microsoft/Windows/CurrentVersion/SharedDlls/ +"; $value = "c:\\aaa.aaa"; # $Registry->{ $key } = { "/$value" => [ "0x0003", "REG_DWORD" ] }; $prevSetting = $Registry->FastDelete(1); $res = delete $Registry->{ $key . $value }; if( $res ) { print( "removed value $value and res is $res\n" ); } else { print( " delete failed and res is '$res'\n" ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TieRegistry FastDelete problem
by ikegami (Patriarch) on Jul 10, 2008 at 21:14 UTC | |
|
Re: TieRegistry FastDelete problem
by pc88mxer (Vicar) on Jul 10, 2008 at 20:44 UTC | |
|
Re: TieRegistry FastDelete problem
by anadem (Scribe) on Jul 10, 2008 at 22:12 UTC |