Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

append to registry value

by perlnewbie2000 (Initiate)
on Feb 03, 2005 at 08:25 UTC ( [id://427555]=perlquestion: print w/replies, xml ) Need Help??

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

is it possible to write a PERL script that appends a given value to a line in the registry database?

Right now my code just takes what I need to write, and overwrites anything in the other key.

Can't I append to the end of the line?

Replies are listed 'Best First'.
Re: append to registry value
by saskaqueer (Friar) on Feb 03, 2005 at 08:52 UTC

    Take a look at Win32::TieRegistry. The following code is untested, but should append "appended data" to the 'bar' string value located under the HKEY_LOCAL_MACHINE\Software\foo key.

    use Win32::TieRegistry; my $reg = Win32::TieRegistry->new(); $reg->Delimeter('/'); my $key = $reg->{"LMachine/Software/foo/"}; my $val = $key->{"/bar"}; $key->{"/bar"} = $val . "appended data";
Re: append to registry value
by cog (Parson) on Feb 03, 2005 at 09:56 UTC
    First, it's not a "PERL script", it's a "Perl script" :-)

    Secondly, take a look at Win32::TieRegistry . It might be the module you need.

Re: append to registry value
by si_lence (Deacon) on Feb 03, 2005 at 08:38 UTC
    Not that I know too much about the registry, but
    can't you just read the old line, append the new
    values and write it back again?
    pseudocode
    my $oldvalue = read_value_from_registry(); my $value = "the thing you want to append"; my $newvalue = $oldvalue.$value; write_to_registry($newvalue);

    si_lence

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://427555]
Approved by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-17 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found