Algorithm-GDiffDelta

 view release on metacpan or  search on metacpan

GDiffDelta.pm  view on Meta::CPAN


Takes three file handles.  The first two are read from, and it must
be possible to seek in them.  The third is written to.

The delta is used to reconstruct I<$file2> from I<$file1>.
The delta must be a valid GDIFF file.

No value is returned.  Errors will cause this function to croak
with a suitable error message.

=back

=head1 ALGORITHM AND DELTA FORMAT

The algorithm and some of the code used in this module was derived
from the xdiff library.  It has been adjusted to write GDIFF deltas,
rather than the custom format used by xdiff (which was funtionally
equivalent but a little simpler than GDIFF).

Notes about how the algorithm works should be added here once I
figure it out myself.

A GDIFF file consists of a five byte header, followed by a sequence
of commands.  Each command has a one byte 'opcode' followed by some
arguments.  The delta file is terminated by opcode zero.

There are two types of commands.  DATA commands have a chunk of literal
data as one of their arguments, which is inserted into the output.
COPY commands cause a chunk of data from the input file to be
inserted into the output.

A GDIFF delta is one-way: if it generates I<$file2> from I<$file1>
then it cannot be used to generate I<$file1> from I<$file2>.

=head1 SEE ALSO

The xdiff library, upon which this module was based:
http://www.xmailserver.org/xdiff-lib.html

GDIFF specification (as a W3C note):
http://www.w3.org/TR/NOTE-gdiff-19970901

RFC 1950, which defines the Adler-32 checksum algorithm:
http://www.faqs.org/rfcs/rfc1950.html

=head1 AUTHOR AND COPYRIGHT

Parts of this library were derived from the code for libxdiff, by
Davide Libenzi E<lt>davidel@xmailserver.orgE<gt>

The rest is Copyright 2004, Geoff Richards E<lt>qef@laxan.comE<gt>

This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version. A copy of the license is available at:
http://www.gnu.org/copyleft/lesser.html

=cut

# vi:ts=4 sw=4 expandtab:



( run in 1.868 second using v1.01-cache-2.11-cpan-5b529ec07f3 )