Archive::Any::Create(3pm)

Archive::Any::Create3pm

Abstract api to create archives (tar.gz and zip)

Usage

  use Archive::Any::Create;
  my $archive = Archive::Any::Create->new;
  $archive->container('foo');               # top-level directory
  $archive->add_file('bar.txt', $data);     # foo/bar.txt
  $archive->add_file('bar/baz.txt', $data); # foo/bar/baz.txt
  $archive->write_file('foo.tar.gz');
  $archive->write_file('foo.zip');
  $archive->write_filehandle(\*STDOUT, 'tar.gz');

Overview

Archive::Any::Create is a wrapper module to create tar/tar.gz/zip files with a single easy-to-use API.

Methods

new

Create new Archive::Any::Create object. No parameters.

container($dir)

Specify a top-level directory (or folder) to contain multiple files. Not necessary but recommended to create a good-manner archive file.

add_file($file, $data)

Add a file that contains $data as its content. $file can be a file in the nested subdirectory.

write_file($filename)

Write an archive file named $filename. This method is DWIMmy, in the sense that it automatically dispatches archiving module based on its filename. So, "$archive->write_file("foo.tar.gz")" will create a tarball and "$archive->write_file("foo.zip")" will create a zip file with the same contents.

write_filehandle($fh, $format)

Write an archive data stream into filehandle. $format is either, tar, tar.gz or zip.

Releases

6 releases since Debian 8 (Jessie); the text changed 2 times.

  1. 8
  2. 9–11
  3. 12–13

Author

Tatsuhiko Miyagawa <[email protected]>

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

From libarchive-any-create-perl 0.3-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.