MIZUTANI, Tociyuki > Text-Diff3-0.10 > Text::Diff3::Diff3

Download:
Text-Diff3-0.10.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Text::Diff3::Diff3 - diff3 component

VERSION ^

0.08

SYNOPSIS ^

    use Text::Diff3;
    my $f = Text::Diff3::Factory->new;
    my $mytext   = $f->create_text([map{chomp; $_} <F0>]);
    my $original = $f->create_text([map{chomp; $_} <F1>]);
    my $yourtext = $f->create_text([map{chomp; $_} <F2>]);
    my $p = $f->create_diff3;
    my $diff3 = $p->diff3($mytext, $origial, $yourtext);

DESCRIPTION ^

This is a component to compute difference sets between three text buffers ported from GNU diff3.c written by Randy Smith.

METHODS ^

$p->diff3($mytext, $origial, $yourtext)

calcurates three way diffences between instances of Text::Diff3::Text. This returns an instance of Text::Diff3::List including instances of Text::Diff3::Range3.

WORK WITH diff(1) ^

Diff3 processor needs to support of a two-way diff plug-in module. There are two requirements for a diff plug-in module.

First, it must independent upon the policy of line numbers in text buffers. Not only line numbers may start zero normally Perl's array, but also it start one diff(1) command output. In this module, any line number scheme is hidden in the capsule of text buffer class.

Second, it must adapt line number parameters in a delete range and an append one due to the numbers of lines treatments in diff3 processor. For instance, diff plug-in modifies the ranges in a same scheme of line number started from 1 such as diff(1) command as follows.

  diff(1) to modified; # original   changed text
  1c1 to 1,1c1,1; # [ qw( a b ) ]   [ qw( A b ) ]
  0a1 to 1,0a1,1; # [ qw( a b ) ]   [ qw( A a b ) ]
  1a2 to 2,1a2,2; # [ qw( a b ) ]   [ qw( a B b ) ]
  2a3 to 3,2a3,3; # [ qw( a b ) ]   [ qw( a b C ) ]
  1d0 to 1,1d1,0; # [ qw( A b c ) ] [ qw( b c ) ]
  2d1 to 2,2d2,1; # [ qw( a B c ) ] [ qw( a c ) ]
  3d2 to 3,3d3,2; # [ qw( a b C ) ] [ qw( a b ) ]

In change case at first one, do not happen modification. In append cases from second to 4th one, increment low line number for the original text side. In delete cases from 5th to 7th one, increment low line number for the modified text side.

Their line numbers are normally dropped in the diff(1) command. So that you do their modifications simply adding success value from the output one if you make a plug-in diff(1) command invoker.

SEE ALSO ^

GNU/diffutils/2.7/diff3.c

   Three way file comparison program (diff3) for Project GNU.
   Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, Inc.
   Written by Randy Smith

Text::Diff3::Factory, Text::Diff3::Text, Text::Diff3::List, Text::Diff3::Range3

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.

syntax highlighting: