Archive-Lha

 view release on metacpan or  search on metacpan

lib/Archive/Lha/Decode.pm  view on Meta::CPAN

    read   => sub { $stream->read(@_) },
    write  => sub { print $fh @_ },
  )
  my $crc16 = $decoder->decode;
  croak "crc mismatch" if $crc16 != $header->crc16;

=head1 DESCRIPTION

This is used to decode/extract an archived file from the stream. Actually this ::Decode class is a factory and decoding is done by a delegated class according to the header's "method" property.

All of the ::Decode subclasses require read/write callbacks. Read callback should take a byte length as an argument, and return the bytes of the length from a file or a string. Write callback should take a part of the decoded (probably binary) string...

=head1 METHODS

=head2 new

takes an Archive::Lha::Header object, and read/write callbacks and creates an appropriate object.

=head2 decode

does the decoding stuff and returns CRC-16 of the decoded string. The decoded string itself is passed to the write callback while decoding (step by step).

=head1 AUTHOR

Kenichi Ishigaki, E<lt>ishigaki@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE



( run in 1.000 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )