… | |
… | |
34 | |
34 | |
35 | require XSLoader; |
35 | require XSLoader; |
36 | |
36 | |
37 | no warnings; |
37 | no warnings; |
38 | |
38 | |
39 | $VERSION = 0.4; |
39 | $VERSION = 0.5; |
40 | |
40 | |
41 | XSLoader::load Algorithm::FEC, $VERSION; |
41 | XSLoader::load Algorithm::FEC, $VERSION; |
42 | |
42 | |
43 | =item $fec = new data_blocks, encoded_blocks, blocksize |
43 | =item $fec = new data_blocks, encoded_blocks, blocksize |
44 | |
44 | |
… | |
… | |
63 | file. |
63 | file. |
64 | |
64 | |
65 | =back |
65 | =back |
66 | |
66 | |
67 | If your data is not of the required size (i.e. a multiple of C<blocksize> |
67 | If your data is not of the required size (i.e. a multiple of C<blocksize> |
68 | bytes), then you must pad it (e.g. with zero bytes) on encoding, and |
68 | bytes), then you must pad it (e.g. with zero bytes) on encoding (and you |
69 | truncate it after decoding. |
69 | should truncate it after decoding). Otherwise, this library croaks. |
|
|
70 | |
|
|
71 | Future versions might instead load the short segment into memory or extend |
|
|
72 | your scalar (this might enable nice tricks, like C<$fec->copy (..., my |
|
|
73 | $x)> :). Mail me if you want this to happen. |
70 | |
74 | |
71 | If called without arguments, the internal storage associated with the |
75 | If called without arguments, the internal storage associated with the |
72 | blocks is freed again. |
76 | blocks is freed again. |
73 | |
77 | |
74 | =item $block = $fec->encode (block_index) |
78 | =item $block = $fec->encode (block_index) |
… | |
… | |
145 | |
149 | |
146 | Utility function that simply copies one block (specified like in |
150 | Utility function that simply copies one block (specified like in |
147 | C<set_encode_blocks>) into another. This, btw., destroys the blocks set by |
151 | C<set_encode_blocks>) into another. This, btw., destroys the blocks set by |
148 | C<set_*_blocks>. |
152 | C<set_*_blocks>. |
149 | |
153 | |
|
|
154 | =back |
|
|
155 | |
150 | =item COMPATIBILITY |
156 | =head1 COMPATIBILITY |
151 | |
157 | |
152 | The way this module works is compatible with the way freenet |
158 | The way this module works is compatible with the way freenet |
153 | (L<http://freenet.sf.net>) encodes files. Comaptibility to other file |
159 | (L<http://freenet.sf.net>) encodes files. Comaptibility to other file |
154 | formats or networks is not know, please tell me if you find more examples. |
160 | formats or networks is not know, please tell me if you find more examples. |
155 | |
161 | |