NAME

Container::Builder::Tar - Class for creating Tar archives from scratch.

DESCRIPTION

Container::Builder::Tar provides several methods to create a TAR archive. It was created because the methods of Archive::Tar didn't allow fine-grained control over permissions and owning users.

METHODS

new()

Create an empty Container::Builder::Tar object.

get_tar()

Return a valid TAR file as a scalar string that is the concatenation of all the directories and files.

add_dir($path, $mode, $uid, $gid)

Add a directory to the TAR archive. Absolute directories will be prefixed with a '.'.

add_file($filepath, $data, $mode, $uid, $gid)

Add a file to the TAR archive. Absolute paths will be prefixed with a '.'.

extract_file($tar, $filepath)

Pass a valid TAR file as a scalar string and a filepath, and this method will return the header + data blocks of the file (or only the header when it's a directory).

extract_wildcard_files($tar, $filepath)

Does the same as extract_file() but allows appending a wildcard (an asterisk) to the path to get all the files matching in the directory. Note that this does not recursively find all files, it will only match the files in the directory of the wildcard.

AUTHOR

Adriaan Dens <adri@cpan.org>

COPYRIGHT

Copyright 2026- Adriaan Dens

LICENSE

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

SEE ALSO

Part of the Container::Builder module.
GNU TAR format