The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Text::Same::MatchMap

DESCRIPTION

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

SYNOPSIS

 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);
     }
   }
 }

METHODS

See below. Methods private to this module are prefixed by an underscore.

new

 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

source1

 Title   : source1
 Usage   : $source = $matchmap->source1();
 Function: returns the source1 argument to new()

source2

 Title   : source2
 Usage   : $source = $matchmap->source2();
 Function: returns the source2 argument to new()

matches

 Title   : matches
 Usage   : my @matches = $matches->matches();
 Function: return the Match objects from the seen_pairs argument to new()

source1_non_matches

 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

source2_non_matches

 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

AUTHOR

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

COPYRIGHT & LICENSE

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.

DISCLAIMER

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