Algorithm-Diff-Any

 view release on metacpan or  search on metacpan

lib/Algorithm/Diff/Any.pm  view on Meta::CPAN

# Algorithm::Diff::Any
#  An interface that automagically selects the XS or Pure Perl port of
#  the diff algorithm (Algorithm::Diff or Algorithm::Diff::XS)
#
# $Id: Any.pm 10595 2009-12-23 00:29:52Z FREQUENCY@cpan.org $

package Algorithm::Diff::Any;

use strict;
use warnings;
use Carp ();

lib/Algorithm/Diff/Any.pm  view on Meta::CPAN


  # Import external subroutines here
  no strict 'refs';
  for my $func (@EXPORT_OK) {
    *{$func} = \&{'Algorithm::Diff::' . $func};
  }
}

=head1 DESCRIPTION

This is a simple module to select the best available implementation of the
standard C<diff> algorithm, which works by effectively trying to solve the
Longest Common Subsequence (LCS) problem. This algorithm is described in:
I<A Fast Algorithm for Computing Longest Common Subsequences>, CACM, vol.20,
no.5, pp.350-353, May 1977.

However, it is algorithmically rather complicated to solve the LCS problem;
for arbitrary sequences, it is an NP-hard problem. Simply comparing two
strings together of lengths I<n> and I<m> is B<O(n x m)>. Consequently, this
means the algorithm necessarily has some tight loops, which, for a dynamic
language like Perl, can be slow.



( run in 1.063 second using v1.01-cache-2.11-cpan-49f99fa48dc )