Archive::Lha::Header - Archive::Lha::Header documentation


Archive-Lha documentation Contained in the Archive-Lha distribution.

Index


Code Index:

NAME

Top

Archive::Lha::Header

SYNOPSIS

Top

  while ( defined ( my $level = $stream->search_header ) ) {
    my $header = Archive::Lha::Header->new(
      level  => $level,
      stream => $stream
    );
    $stream->seek( $header->next_header );
  }

DESCRIPTION

Top

This is a factory class to create a proper header object. Each ::Header subclass has several public methods and several minor private properties. See Archive::Lha::Header::Base for details.

METHODS

Top

new

takes a hash as an argument and returns a delegated header object. Required options are:

level

LHa header level (0 to 2). Actually Level 3 header is proposed but I don't think there's substantial implementation that supports it while creating archives.

stream

(a subclass of) Archive::Lha::Stream object.

AUTHOR

Top

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Top


Archive-Lha documentation Contained in the Archive-Lha distribution.

package Archive::Lha::Header;

use strict;
use warnings;
use Carp;

sub new {
  my ($class, %options) = @_;

  croak "Stream is missing"       unless defined $options{stream};
  croak "Header level is missing" unless defined $options{level};

  croak "Illegal header level: $options{level}"
    unless $options{level} =~ /^(?:[0-2])$/;

  my $package = 'Archive::Lha::Header::Level'.$options{level};
  eval "require $package;";
  croak "Can't load header parser: $@" if $@;

  $package->new( $options{stream} );
}

1;

__END__