| 1 |
This is a module for computing the difference between two files, two |
| 2 |
strings, or any other two lists of things. It uses an intelligent |
| 3 |
algorithm similar to (or identical to) the one used by the Unix "diff" |
| 4 |
program. It is guaranteed to find the *smallest possible* set of |
| 5 |
differences. |
| 6 |
|
| 7 |
This package contains a few parts. |
| 8 |
|
| 9 |
Algorithm::Diff is the module that contains several interfaces for which |
| 10 |
computing the differences betwen two lists. |
| 11 |
|
| 12 |
The several "diff" programs also included in this package use |
| 13 |
Algorithm::Diff to find the differences and then they format the output. |
| 14 |
|
| 15 |
Algorithm::Diff also includes some other useful functions such as "LCS", |
| 16 |
which computes the longest common subsequence of two lists. |
| 17 |
|
| 18 |
A::D is suitable for many uses. You can use it for finding the smallest |
| 19 |
set of differences between two strings, or for computing the most |
| 20 |
efficient way to update the screen if you were replacing "curses". |
| 21 |
|
| 22 |
Algorithm::DiffOld is a previous version of the module which is included |
| 23 |
primarilly for those wanting to use a custom comparison function rather |
| 24 |
than a key generating function (and who don't mind the significant |
| 25 |
performance penalty of perhaps 20-fold). |
| 26 |
|
| 27 |
diff.pl implements a "diff" in Perl that is as simple as (was |
| 28 |
previously) possible so that you can see how it works. The output |
| 29 |
format is not compatible with regular "diff". It needs to be |
| 30 |
reimplemented using the OO interface to greatly simplify the code. |
| 31 |
|
| 32 |
diffnew.pl implements a "diff" in Perl with full bells and whistles. By |
| 33 |
Mark-Jason, with code from cdiff.pl included. |
| 34 |
|
| 35 |
cdiff.pl implements "diff" that generates real context diffs in either |
| 36 |
traditional format or GNU unified format. Original contextless |
| 37 |
"context" diff supplied by Christian Murphy. Modifications to make it |
| 38 |
into a real full-featured diff with -c and -u options supplied by Amir |
| 39 |
D. Karger. |
| 40 |
|
| 41 |
Yes, you can use this program to generate patches. |
| 42 |
|
| 43 |
OTHER RESOURCES |
| 44 |
|
| 45 |
"Longest Common Subsequences", at |
| 46 |
http://www.ics.uci.edu/~eppstein/161/960229.html |
| 47 |
|
| 48 |
This code was adapted from the Smalltalk code of Mario Wolczko |
| 49 |
<[email protected]>, which is available at |
| 50 |
ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st |
| 51 |
|
| 52 |
THANKS SECTION |
| 53 |
|
| 54 |
Thanks to Ned Konz's for rewriting the module to greatly improve |
| 55 |
performance, for maintaining it over the years, and for readilly handing |
| 56 |
it over to me so I could plod along with my improvements. |
| 57 |
|
| 58 |
(From Ned Konz's earlier versions): |
| 59 |
|
| 60 |
Thanks to Mark-Jason Dominus for doing the original Perl version and |
| 61 |
maintaining it over the last couple of years. Mark-Jason has been a huge |
| 62 |
contributor to the Perl community and CPAN; it's because of people like |
| 63 |
him that Perl has become a success. |
| 64 |
|
| 65 |
Thanks to Mario Wolczko <[email protected]> for writing and making |
| 66 |
publicly available his Smalltalk version of diff, which this Perl |
| 67 |
version is heavily based on. |
| 68 |
|
| 69 |
Thanks to Mike Schilli <[email protected]> for writing sdiff and |
| 70 |
traverse_balanced and making them available for the Algorithm::Diff |
| 71 |
distribution. |
| 72 |
|
| 73 |
(From Mark-Jason Dominus' earlier versions): |
| 74 |
|
| 75 |
Huge thanks to Amir Karger for adding full context diff supprt to |
| 76 |
"cdiff.pl", and then for waiting patiently for five months while I let |
| 77 |
it sit in a closet and didn't release it. Thank you thank you thank |
| 78 |
you, Amir! |
| 79 |
|
| 80 |
Thanks to Christian Murphy for adding the first context diff format |
| 81 |
support to "cdiff.pl". |