Config::PatchConfig::Patch Perl module can be used to patch configuration files and unpatch them later. | |
Download |
Config::Patch Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Mike Schilli
- Publisher web site:
- http://search.cpan.org/~mschilli/X10-Home-0.03/Home.pm
Config::Patch Tags
Config::Patch Description
Config::Patch Perl module can be used to patch configuration files and unpatch them later. Config::Patch Perl module can be used to patch configuration files and unpatch them later.SYNOPSIS use Config::Patch; my $patcher = Config::Patch->new( file => "/etc/syslog.conf", key => "mypatch", ); # Append a patch: $patcher->append(q{ # Log my stuff my.* /var/log/my }); # Appends the following to /etc/syslog.conf: *------------------------------------------- | ... | #(Config::Patch-mypatch-append) | # Log my stuff | my.* /var/log/my | #(Config::Patch-mypatch-append) *------------------------------------------- # Prepend a patch: $patcher->prepend(q{ # Log my stuff my.* /var/log/my }); # Prepends the following to /etc/syslog.conf: *------------------------------------------- | #(Config::Patch-mypatch-append) | # Log my stuff | my.* /var/log/my | #(Config::Patch-mypatch-append) | ... *------------------------------------------- # later on, to remove the patch: $patcher->remove();Config::Patch helps changing configuration files, remembering the changes, and undoing them if necessary.Every change (patch) is marked by a key, which must be unique for the change, in order allow undoing it later on.To facilitate its usage, Config::Patch comes with a command line script that performs all functions: # Append a patch echo "my patch text" | config-patch -a -k key -f textfile # Patch a file by search-and-replace echo "none:" | config-patch -s 'all:.*' -k key -f config_file # Comment out sections matched by a regular expression: config-patch -c '(?ms-xi:^all:.*?nn)' -k key -f config_file # Remove a previously applied patch config-patch -r -k key -f textfileNote that 'patch' doesn't refer to a patch in the format used by the patch program, but to an arbitrary section of text inserted into a file. Patches are line-based, Config::Patch always adds/removes entire lines. Requirements: · Perl
Config::Patch Related Software