diff

(Current version 1.10; last updated 15 December 2000)

News flash: (15 December 2000) Ned Konz has taken over maintenance of Algorithm::Diff and has rewritten it. The result is a big improvement.


This is a reimplementation of the unix diff program. You name two files on the command line, and diff tells you where the files differ, in a format similar to the output of the standard diff -u. For example, if the two files contain lines as follows:

	File 1			File 2
	------			------
	a			c
	b			d
	d			e
	h			f
	j			h
	k			i
				j

Then the output of diff will look like this:

   1- a
   2- b
   1+ c
--------
   3+ e
   4+ f
--------
   6+ i
--------
   6- k
--------

What does this mean? It is a set of instructions for turning file 1 into file 2. The instructions come in four chunks, separated by --------. The first chunk says that in file 2, the `a' and `b' have been removed and replaced with `c'. The second chunk says that file 2 has `e' and `f' that are not present in file 1. The third chunk says that file 2 has `i' that is not present in file 1. The last chunk says that the `k' is missing from file 2.

If you don't like this output format, it shouldn't be very hard to change. See the documentation for Diff.pm for more details; that's where most of the work is done.

To join a low-volume mailing list for announcements related to diff and Algorithm::Diff, send an empty note to mjd-perl-diff-subscribe@plover.com.

What's New in 1.10

Ned Konz's rewrite of the module is a big improvement. The module is much more time- and memory-efficient than it was before. Ned will be maintaining it from now on. For more details, see the change file.

What's New in 0.57

Changed the name to Algorithm::Diff. Now includes Amir Karger's changes to cdiff.pl that make it actually print out context in context diffs. (Traditional or `unified' formats.) You can now use cdiff.pl to generate patches and nobody will know you didn't use the standard diff program.

What's New in 0.54

First CPAN release! Now includes Christian Murphy's cdiff.pl, a program that generates an output that is enough like regular diff that you can use it as the input to patch.

What's New in 0.52

This was the initial release.

Download and Peruse

TODO list

I'm seeking volunteers for all these projects.

News flash: Today (4 Sep 98) I got an extra copy of The Perl Cookbook in the mail. I will give it away to the first person who gives me significant help on one of these projects.

This wonderful book was published this year by O'Reilly and Associates and was written by Tom Christiansen and Nathan Torkington. It is 757 pages long and normally retails for US$39.95.

Contact me before starting, or you might find out afterwards that I've already given it away.

News flash: (6 Sep 98) Christian Murphy implemented cdiff.pl, a program that generates patches, in the form of diff -c, but without the context. But he says he doesn't want the book yet, so I suppose it's still available. Perhaps someone would like to add the context part to Christian's program now that he has taken care of the rest of it for you?

News flash: (22 Sep 1998) Amir Karger submitted a working diff program that does context diffs and unified diffs. He wins the Cookbook.

3 March 1999

I finally got off my butt about this. Here it is.


Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia

mjd-perl-diff@plover.com