ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/File-Rdiff/Rdiff.pm
(Generate patch)

Comparing File-Rdiff/Rdiff.pm (file contents):
Revision 1.1 by root, Thu Mar 21 23:49:01 2002 UTC vs.
Revision 1.4 by root, Wed Jan 12 20:35:42 2005 UTC

1=head1 NAME 1=head1 NAME
2 2
3File::Rdiff 3File::Rdiff -- generate remote signatures and patch files using librsync
4 4
5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use File::Rdiff 7 use File::Rdiff
8 8
115 115
116Set the eof flag to true. This indicates that no data is following the current input scalar. 116Set the eof flag to true. This indicates that no data is following the current input scalar.
117 117
118=item $buffers->avail_in 118=item $buffers->avail_in
119 119
120Returns the numer of bytes still available for input. 120Returns the numer of bytes still available for input. If there are no
121input bytes available but the eof flag is set, returns -1 (to make boolean
122tests easy to check wether to supply more data easier).
121 123
122=item $buffers->avail_out 124=item $buffers->avail_out
123 125
124Returns the number of bytes still available in the output buffer. 126Returns the number of bytes still available in the output buffer.
125 127
129 131
130=back 132=back
131 133
132=head2 The File::Rdiff::Job class 134=head2 The File::Rdiff::Job class
133 135
136It is possible to have multiple jobs running at the same time. The idea
137is to create job objects and then drive them incrementally with input or
138output data until all date has been processed.
139
134=over 4 140=over 4
135 141
142=item new_sig File::Rdiff::Job [$new_block_len[, $strong_sum_len]]
143
144Create a job that converts a base stream into a signature stream (i.e. creates signatures).
145
146=item new_loadsig File::Rdiff::Job
147
148Create a job that converts the input stream into a in-memory
149File::Rdiff::Signature object. The signature object can be fetched anytime
150with the C<signature>-method.
151
152=item new_delta File::Rdiff::Job $signature
153
154Creates a job that creates (outputs) a delta between the input stream (the
155newer file) and the file represented by the given signature.
156
157=item new_patch File::Rdiff::Job $callback_or_filehandle
158
159Creates a job that patches a file according to the input stream (a delta
160stream). The single argument is used to read the base file contents. If it
161is a filehandle, it must be a seekable handle to the base file.
162
163If it is a coderef, it will be called whenever base file data must be
164read. Two arguments will be passed: the file offset and the length. The
165callback should eithe return the data read (must be a string, not a
166number!) or an error code.
167
168=item $job->iter($buffers)
169
170Do as much work as possible given the input and/or output data in the
171File::Rdiff::Buffers structure and return either C<DONE> when the job is
172finished, C<BLOCKED> if there aren't enough bytes available in the input
173or output buffers (in which case you should deplete the output buffer
174and/or fill the input buffer and loop), or some error code indicating that
175the operation failed.
176
177=item $job->signature
178
179Only valid for C<new_loadsig>, so look there.
180
136=back 181=back
137 182
138=head1 SEE ALSO 183=head1 SEE ALSO
139 184
140L<File::Rsync>, L<rdiff1> (usage example using simple file API), L<rdiff2> (example using nonblocking API). 185L<File::Rsync>, L<rdiff1> (usage example using simple file API), L<rdiff2> (example using nonblocking API).
150- documentation leaves much to be deserved. 195- documentation leaves much to be deserved.
151 196
152=head1 AUTHOR 197=head1 AUTHOR
153 198
154 Marc Lehmann <pcg@goof.com> 199 Marc Lehmann <pcg@goof.com>
155 http://www.goof.com/pcg/marc/ 200 http://home.schmorp.de/
156 201
157=cut 202=cut
158 203
1591; 2041;
160 205

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines