Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    Config::Patch 0.09

    Download button

    No screenshots available
    Downloads: 360  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.4/5)
    5 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Mike Schilli | More programs
    Perl Artistic License / FREE
    February 20th, 2008, 14:36 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Config::Patch description

    A module which 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 textfile

    Note 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.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    patch configuration files | unpatch configuration files | Perl module | patch | unpatch | configurations

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM