Algorithm-Diff
view release on metacpan or search on metacpan
lib/Algorithm/Diff.pm view on Meta::CPAN
@_
);
return wantarray ? @$retval : $retval;
}
########################################
my $Root= __PACKAGE__;
package Algorithm::Diff::_impl;
use strict;
sub _Idx() { 0 } # $me->[_Idx]: Ref to array of hunk indices
# 1 # $me->[1]: Ref to first sequence
# 2 # $me->[2]: Ref to second sequence
sub _End() { 3 } # $me->[_End]: Diff between forward and reverse pos
sub _Same() { 4 } # $me->[_Same]: 1 if pos 1 contains unchanged items
sub _Base() { 5 } # $me->[_Base]: Added to range's min and max
sub _Pos() { 6 } # $me->[_Pos]: Which hunk is currently selected
sub _Off() { 7 } # $me->[_Off]: Offset into _Idx for current position
sub _Min() { -2 } # Added to _Off to get min instead of max+1
sub Die
{
require Carp;
Carp::confess( @_ );
}
sub _ChkPos
{
my( $me )= @_;
if ! $^S;
die @_;
};
$SIG{__WARN__} = sub # breakpoint on warn
{
$DB::single = 1;
warn @_;
};
}
sub Ok($$) { @_= reverse @_; goto &ok }
my( $first, $a, $b, $hunks );
for my $pair (
[ "a b c e h j l m n p",
" b c d e f j k l m r s t", 9 ],
[ "", "", 0 ],
[ "a b c", "", 1 ],
[ "", "a b c d", 1 ],
[ "a b", "x y z", 1 ],
[ " c e h j l m n p r",
( run in 0.425 second using v1.01-cache-2.11-cpan-cba739cd03b )