
Text::Same::MatchMap

Objects of this class are returned by Text::Same::compare() and hold the results of comparison in a convenient form.

use Text::Same;
use Text::Same::TextUI;
my $matchmap = compare(\%options, $file1, $file2);
if ($options{show_matches}) {
my @matches = $matchmap->matches;
for my $match (@matches) {
if (!defined $options{min_score} or $match->score >= $options{min_score}) {
print draw_match(\%options, $match);
}
}
}

See below. Methods private to this module are prefixed by an underscore.
Title : new
Usage : $matchmap = new Text::Same::MatchMap(options=>$options,
source1=>$source1,
source2=>$source2,
seen_pairs=>\%seen_pairs);
Function: Creates a new MatchMap object for a comparison
Returns : A Text::Same::MatchMap object
Args : options - the options used by Text::Same::compare();
source1 - a ChunkedSource for the first source
source2 - a ChunkedSource for the second source
seen_pairs - a hash from ChunkPair to Match object, used during
comparison to record which pairs of chunks (ie.
pairs of lines) have been assigned to a Match
Title : source1 Usage : $source = $matchmap->source1(); Function: returns the source1 argument to new()
Title : source2 Usage : $source = $matchmap->source2(); Function: returns the source2 argument to new()
Title : matches Usage : my @matches = $matches->matches(); Function: return the Match objects from the seen_pairs argument to new()
Title : source1_non_matches
Usage : my @ranges = $matchmap->source1_non_matches();
Function: return the ranges of chunks/lines from source1 that didn't match
any lines from source2
Title : source2_non_matches
Usage : my @ranges = $matchmap->source2_non_matches();
Function: return the ranges of chunks/lines from source2 that didn't match
any lines from source1

Kim Rutherford <kmr+same@xenu.org.uk>

Copyright 2005,2006 Kim Rutherford. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

This module is provided "as is" without warranty of any kind. It may redistributed under the same conditions as Perl itself.