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

I am writing a program that deals with diffs. Looking through CPAN, I find Text::Diff, which will make my life much easier when generating the diffs. I do not see any simple way of applying the diffs, however. Basically, I have the equivalent of the GNU diff program, and I need the equivalent of patch. I tried seeking the assistance of Super Search to no avail.

I apologize if this was posted to the wrong place, but this is my first post to the Monestary. Also, I do not have any code, because at this time I am only in the research and planning phase.

Any help will be greatly appreciated,
revdiablo

  • Comment on Is there a well known module or simple algorithm for applying a diff?

Replies are listed 'Best First'.
Re: Is there a well known module or simple algorithm for applying a diff?
by Kanji (Parson) on Sep 15, 2002 at 00:02 UTC
Re: Is there a well known module or simple algorithm for applying a diff?
by japhy (Canon) on Sep 15, 2002 at 04:05 UTC
    "Is there a well known module or simple algorithm for applying a diff?" Algorithm::Diff.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

      I am looking for help applying a diff, not creating a diff. :) I was aware of Algorithm::Diff, due to the fact that it's used by Text::Diff.

      It looks like VPC::Patch will do what I want, but a bit hesitant to use it, since it seems to be specifically for RevML. I'll probably end up just rolling my own.

Re: Is there a well known module or simple algorithm for applying a diff?
by Flexx (Pilgrim) on Sep 14, 2002 at 22:54 UTC

    Well, my first idea would be to use system('patch'), if there's no way to do it within perl...

    But you could also look here: CPAN search on patch

    So long,
    Flexx