in reply to Super Diff?

Algorithm::Diff is pretty good for producing diff like output for two variables in Perl, but I would definitly just use: `/usr/bin/diff $file[1] $file[2]` to get the diff of files, its simpler. Also I'd suggest File::Find with a wanted funciton that checks the date range in order to pick your files

Algorithm::Diff useage for difflike output looks something like:

sub diffy { my $output; my @one = split(/\n/, $_[0]); my @two = split(/\n/, $_[1]); my $equ = $_[2] || "=="; my $sub = $_[3] || "--"; my $add = $_[4] || "++"; my $eqX = $_[5] || ""; my $suX = $_[6] || ""; my $adX = $_[7] || ""; use Algorithm::Diff qw(traverse_sequences); traverse_sequences(\@one, \@two, { MATCH => sub { $output .= "$equ$one[shift]$eqX\n"}, DISCARD_A => sub { $output .= "$sub$one[shift]$suX\n"}, DISCARD_B => sub { $output .= "$add$two[shift,shift]$adX\n"}, }); return $output; }
Which is sorta odd looking, but now that you have that code, you don't really have to think about it. Here you can pass in $one and $two as variables holding multi-line input, and optionally pass in start tags for matching lines, deleted lines, and added lines, as well as the end tags for the same.

-Daniel

Edit: 2001-03-03 by neshura

Replies are listed 'Best First'.
Re: Re: Super Diff?
by daniell (Sexton) on Feb 13, 2001 at 00:17 UTC
    whops; I'm not anonymous