On some servers diff or diff3 are not available. This extension uses the perl modules Algorithm::Diff and Algorithm::Merge. Currently everything is work in progress. Attention! The author (TilmannHolst) is a perl noob. Probably this extension will eat your data.

Some diffs are already working. The diff links on RecentChanges for example. Using "View other revisions" produces an error. The reason is simple: Algorithm::Diff wants a list context but is called in a scalar context.

Can't use string ("Log your promotion activities he") as an ARRAY ref while "strict refs" in use at Algorithm/Diff.pm line 557.

Uhmmm, I'm really not a Perl expert, even if I used it from time to time; please accept these comments on your code, I'm being verbose due to the fact that you classify yourself as a noob.

What really looks strange to me is the use of arrays:

my ( @old, @new ) = @_;

which really doesn't give you what you're expecting. Perl 5 is somewhat "greed" in assignment, so your syntax really assigns all the input parameters to @old, leaving @new empty... Definitively not what you're after, I suspect! Looking at the original GetDiff function, from Oddmuse source:

my ($old, $new, $oldRevision) = @_; # Reuse this

we see that the text are passed as scalars, not as arrays, so you should stick to this. Moreover, there is a third parameter that's messing around and that you have to take into account - I suggest you to take more code from the original GetDiff, changing only the parts that actually require diff.

Alternative

You could just use the cdiff.pl script that comes with Algorithm::Diff (and uses it, of course). On my system it is available as /usr/share/doc/libalgorithm-diff-perl/examples/cdiff.pl.gz. What do you think?

My problem seems to be the understanding of perls references. I looked at cdiff.pl and found what I expected Things like @$foo or (\@foo, \@bar). This is ugly, but perl. I'll read man perlref and try again on Sunday... --TilmannHolst

There is no cmerge.pl script that comes with Algorithm::Merge, however.