The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

NAME

Archive::Libarchive::Archive - Libarchive archive base object

VERSION

version 0.08

SYNOPSIS

 # handle errors correctly.
 my $code = $r->read_data(\$data);
 if($code == ARCHIVE_WARN) {
   warn $r->error_string;
 } elsif($code == ARCHIVE_FAIL || $code == ARCHIVE_FATAL) {
   die $r->error_string;
 }

DESCRIPTION

This class is a base class for all archive classes in Archive::Libarchive.

METHODS

This is a subset of total list of methods available to all archive classes. For the full list see "Archive::Libarchive::Archive" in Archive::Libarchive::API.

entry

 # archive_entry_new2
 my $e = $ar->entry;

This method creates a new Archive::Libarchive::Entry instance, like when you create an instance with that class' new method, except this form will pull character-set conversion information from the specified archive instance.

errno

 # archive_errno
 my $int = $ar->errno;

Returns the system errno code for the archive instance. For non-system level errors, this will not have a sensible value.

error_string

 # archive_error_string
 my $string = $ar->error_string;

Returns a human readable diagnostic of error for the corresponding archive instance.

clear_error

 # archive_clear_error
 $ar->clear_error;

Clear the error for the corresponding archive instance.

set_error

 # archive_set_error
 $ar->set_error($errno, $string);

This will set the errno code and human readable diagnostic for the archive instance. Not all errors have a corresponding errno code, so you can set that to zero (0) in that case.

filter_code

 # archive_filter_code
 my $code = $ar->filter_code($num);

This will return the filter code at position $num. For the total number of positions see the filter_count method.

The constant prefix for this method is ARCHIVE_FILTER_. This will return a dualvar where the string is the lowercase name without the prefix and the integer is the constant value. For the full list see "CONSTANTS" in Archive::Libarchive::API.

format

 # archive_format
 my $code = $ar->format;

This will return the format code at position $num.

The constant prefix for this method is ARCHIVE_FORMAT_. This will return a dualvar where the string is the lowercase name without the prefix and the integer is the constant value. For the full list see "CONSTANTS" in Archive::Libarchive::API.

SEE ALSO

Archive::Libarchive::Peek

Provides an interface for listing and retrieving entries from an archive without extracting them to the local filesystem.

Archive::Libarchive::Extract

Provides an interface for extracting arbitrary archives of any format/filter supported by libarchive.

Archive::Libarchive::Unwrap

Decompresses / unwraps files that have been compressed or wrapped in any of the filter formats supported by libarchive

Archive::Libarchive

This is the main top-level module for using libarchive from Perl. It is the best place to start reading the documentation. It pulls in the other classes and libarchive constants so that you only need one use statement to effectively use libarchive.

Archive::Libarchive::API

This contains the full and complete API for all of the Archive::Libarchive classes. Because libarchive has hundreds of methods, the main documentation pages elsewhere only contain enough to be useful, and not to overwhelm.

Archive::Libarchive::ArchiveRead

This class is used for reading from archives.

Archive::Libarchive::ArchiveWrite

This class is for creating new archives.

Archive::Libarchive::DiskRead

This class is for reading Archive::Libarchive::Entry objects from disk so that they can be written to Archive::Libarchive::ArchiveWrite objects.

Archive::Libarchive::DiskWrite

This class is for writing Archive::Libarchive::Entry objects to disk that have been written from Archive::Libarchive::ArchiveRead objects.

Archive::Libarchive::Entry

This class represents a file in an archive, or on disk.

Archive::Libarchive::EntryLinkResolver

This class exposes the libarchive link resolver API.

Archive::Libarchive::Match

This class exposes the libarchive match API.

Dist::Zilla::Plugin::Libarchive

Build Dist::Zilla based dist tarballs with libarchive instead of the built in Archive::Tar.

Alien::Libarchive3

If a suitable system libarchive can't be found, then this Alien will be installed to provide it.

libarchive.org

The libarchive project home page.

https://github.com/libarchive/libarchive/wiki

The libarchive project wiki.

https://github.com/libarchive/libarchive/wiki/ManualPages

Some of the libarchive man pages are listed here.

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021,2022 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.