GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TEXT::DIFF3::DIFFHECKEL (3)

.ds Aq ’

NAME

Text::Diff3::DiffHeckel - two-way diff component

CONTENTS

VERSION

0.08

SYNOPSIS



  use Text::Diff3;
  my $f = Text::Diff3::Factory->new;
  my $p = $f->create_diff;
  my $mytext   = $f->create_text([map {chomp; $_} <F0> ]);
  my $original = $f->create_text([map {chomp; $_} <F1> ]);
  my $diff2 = $p->diff($original, $mytext);
  $diff2->each(sub{
      my($r) = @_;
      print $r->as_string, "\n";
      if ($r->type ne a) { # delete or change
          print -, $original->as_string_at($_) for $r->rangeA;
      }
      if ($r->type ne d) { # append or change
          print +, $mytext->as_string_at($_) for $r->rangeB;
      }
  });



DESCRIPTION

This is a package for Text::Diff3 to compute difference sets between two text buffers based on the P. Heckel’s algorithm. Anyone may change this to an another diff or a its wrapper module by a your custom Factory instance.

Text::Diff3 needs a support of computing difference sets between two text buffers (diff). As the diff(1) command, the required diff module creates a list of tipples recorded an information set of a change type (such as a, c, or d) and a range of line numbers between two text buffers.

Since there are several algorithms and their implementations for the diff computation, Text::Diff3 makes a plan independent on any specific diff routine. It calls a pluggable diff processor instance specified in a factory commonly used in Text::Diff3. Anyone may change diff plug-in according to text properties.

For users convenience, Text::Diff3 includes small diff based on the P. Heckel’s algorithm. On the other hands, many other systems use the popular Least Common Sequence (LCS) algorithm. The merits for each algorithm are case by case. In author’s experience, two algorithms generate almost same results for small local changes in the text. In some cases, such as moving blocks of lines, it happened quite differences in results.

METHODS

$f->create_diff Author recommends you to create an instance of diff processor by using with a factory as follows.



  use SomeFactory;
  my $f = SomeFactory->new;
  my $p = $f->create_diff;



Text::Diff3::Factory is a class to packaging several classes for the building diff processor.

$p->diff($origial, $mytext) Performing the diff process, we send a ‘diff’ message with two text instances to the receiver,



  my $diff2 = $p->diff($origial, $mytext);



where the parameters of text are a kind as follows.
o Scalar string separated by \n.
o References of a one-dimensional array.
o An already blessed instance by Text::Diff3::Text or an equivalent type as one.

After the process, the receiver returns the list as difference sets.

SEE ALSO

P. Heckel. ‘‘A technique for isolating differences between files.’’ Communications of the ACM, Vol. 21, No. 4, page 264, April 1978.

Text::Diff3::Diff3

COMPATIBILITY

Use new function style interfaces introduced from version 0.08. This module remained for backward compatibility before version 0.07. This module is no longer maintenance after version 0.08.

AUTHOR

MIZUTANI Tociyuki <tociyuki@gmail.com>.

LICENSE AND COPYRIGHT

Copyright (C) 2010 MIZUTANI Tociyuki

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TEXT::DIFF3::DIFFHECKEL (3) 2010-02-19

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.