diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLConfFile.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfFile.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfFile.pm b/Master/tlpkg/TeXLive/TLConfFile.pm index 2049b4c85bc..33ca89e55bf 100644 --- a/Master/tlpkg/TeXLive/TLConfFile.pm +++ b/Master/tlpkg/TeXLive/TLConfFile.pm @@ -125,6 +125,24 @@ sub value return; } +sub rename_key +{ + my ($self, $oldkey, $newkey) = @_; + %config = %{$self{'confdata'}}; + for my $i (0..$config{'lines'}) { + if (($config{$i}{'type'} eq 'data') && + ($config{$i}{'key'} eq $oldkey)) { + $config{$i}{'key'} = $newkey; + } + } + if (defined($self{'keyvalue'}{$oldkey})) { + $self{'keyvalue'}{$newkey} = $self{'keyvalue'}{$oldkey}; + delete $self{'keyvalue'}{$oldkey}; + $self{'keyvalue'}{$newkey}{'status'} = 'changed'; + + } +} + sub is_changed { my $self = shift; @@ -479,6 +497,11 @@ if the key is not set. With two arguments changes (or adds) the key/value pair to the config file and returns the I<new> value. +=item B<< $conffile->rename_key($oldkey, $newkey) >> + +Renames a key from C<$oldkey> to C<$newkey>. It does not automatically +save the new config file. + =item B<< $conffile->is_changed >> Returns true (1) if some real change has happened in the configuration file, |