rhew.org |
All of the documented interfaces to Algorithm::Diff are built around one core function, traverse_sequences(). In addition to the lists to compare, the user supplies a key generation function and a set of callbacks. traverse_sequences() takes the two lists and applies a standard difference algorithm to them.
traverse_sequences( \@seq1, \@seq2,
{ MATCH => $callback,
DISCARD_A => $callback,
DISCARD_B => $callback,
},
$key_generation_function );
|
MATCH |
The MATCH callback is called with indices of two matching elements in the lists. |
|
DISCARD_A |
The DISCARD_A callback is called with the index of an element in the first list that does not exist in the second. |
|
DISCARD_B |
The DISCARD_B callback is called with the index of an element in the second list that does not exist in the first. |
|
LCS |
LCS (Longest Common Subsequence) returns the longest sequence of elements common to both user specified lists. |
|
diff |
diff returns a list of optimized deletion and addition instructions for transforming the first user specified list into the second. |
|
rhew.org (c) 2001 James Rhew |