Algorithm-Diff-Any
view release on metacpan or search on metacpan
lib/Algorithm/Diff/Any.pm view on Meta::CPAN
=item * LCS_length
=item * diff
=item * sdiff
=item * compact_diff
=item * traverse_sequences
=item * traverse_balanced
=back
For full documentation, see the relevant functional descriptions in the Pure
Perl implementation, L<Algorithm::Diff>.
=cut
=head1 METHODS
=head2 new
Algorithm::Diff::Any->new( \@seq1, \@seq2, \%opts );
Creates a C<Algorithm::Diff::Any> object, based upon either the optimized
C/XS version of the algorithm, L<Algorithm::Diff::XS>, or falls back to
the Pure Perl implementation, L<Algorithm::Diff>.
Example code:
my $diff = Algorithm::Diff::Any->new( \@seq1, \@seq2 );
# or with options
my $diff = Algorithm::Diff::Any->new( \@seq1, \@seq2, \%opts );
This method will return an appropriate B<Algorithm::Diff::Any> object or
throw an exception on error.
=cut
# Wrappers around the actual methods
sub new {
my ($class, $seq1, $seq2, $opts) = @_;
Carp::croak('You must call this as a class method') if ref($class);
Carp::croak('You must provide two sequences to compare as array refs')
unless (ref($seq1) eq 'ARRAY' && ref($seq2) eq 'ARRAY');
my $self = {
};
if ($DRIVER eq 'XS') {
$self->{backend} = Algorithm::Diff::XS->new($seq1, $seq2, $opts);
}
else {
$self->{backend} = Algorithm::Diff->new($seq1, $seq2, $opts);
}
bless($self, $class);
return $self;
}
=head2 Next
$diff->Next( $count )
See L<Algorithm::Diff> for method documentation.
=cut
sub Next {
shift->{backend}->Next(@_);
}
=head2 Prev
$diff->Prev( $count )
See L<Algorithm::Diff> for method documentation.
=cut
sub Prev {
shift->{backend}->Prev(@_);
}
=head2 Reset
$diff->Reset( $pos )
See L<Algorithm::Diff> for method documentation.
=cut
sub Reset {
my $self = shift;
$self->{backend}->Reset(@_);
return $self;
}
=head2 Copy
$diff->Copy( $pos, $newBase )
See L<Algorithm::Diff> for method documentation.
=cut
sub Copy {
shift->{backend}->Copy(@_);
}
=head2 Base
$diff->Base( $newBase )
See L<Algorithm::Diff> for method documentation.
=cut
( run in 0.815 second using v1.01-cache-2.11-cpan-0b5f733616e )