• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

eg/H13-Sep-2020-10934

lib/Archive/Tar/H13-Sep-2020-1,264511

t/H13-Sep-2020-540432

xt/H13-Sep-2020-384341

CONTRIBUTING.mdH A D06-Apr-2019619 2212

ChangesH A D13-Sep-20208.3 KiB214174

LICENSEH A D02-Jun-201834.3 KiB675553

MANIFESTH A D13-Sep-2020532 2928

MANIFEST.SKIPH A D02-Jun-2018103 1110

META.jsonH A D13-Sep-20201.8 KiB7271

META.ymlH A D13-Sep-20201 KiB4039

Makefile.PLH A D07-Sep-20203.4 KiB121102

README.mdH A D13-Sep-20205.2 KiB144105

README.md

1# NAME
2
3Archive::Tar::Wrapper - API wrapper around the 'tar' utility
4
5# SYNOPSIS
6
7```perl
8    use Archive::Tar::Wrapper;
9
10    my $arch = Archive::Tar::Wrapper->new();
11
12    # Open a tarball, expand it into a temporary directory
13    $arch->read("archive.tgz");
14
15    # Iterate over all entries in the archive
16    $arch->list_reset(); # Reset Iterator
17
18    # Iterate through archive
19    while(my $entry = $arch->list_next()) {
20        my($tar_path, $phys_path) = @$entry;
21        print "$tar_path\n";
22    }
23
24    # Get a huge list with all entries
25    for my $entry (@{$arch->list_all()}) {
26        my($tar_path, $real_path) = @$entry;
27        print "Tarpath: $tar_path Tempfile: $real_path\n";
28    }
29
30    # Add a new entry
31    $arch->add($logic_path, $file_or_stringref);
32
33    # Remove an entry
34    $arch->remove($logic_path);
35
36    # Find the physical location of a temporary file
37    my($tmp_path) = $arch->locate($tar_path);
38
39    # Create a tarball
40    $arch->write($tarfile, $compress);
41```
42
43# DESCRIPTION
44
45`Archive::Tar::Wrapper` is an API wrapper around the `tar` command line
46program. It never stores anything in memory, but works on temporary
47directory structures on disk instead. It provides a mapping between
48the logical paths in the tarball and the 'real' files in the temporary
49directory on disk.
50
51It differs from `Archive::Tar` in two ways:
52
53* `Archive::Tar::Wrapper` doesn't hold anything in memory. Everything is
54stored on disk.
55* `Archive::Tar::Wrapper` is 100% compliant with the platform's `tar`
56utility, because it uses it internally.
57
58# DOCUMENTATION
59
60Be sure to check out the POD documentation available with the distribution!
61
62# KNOWN LIMITATIONS
63
64* Currently, only `tar` programs supporting the `z` option (for
65compressing/decompressing) are supported. Future version will use
66`gzip` alternatively.
67* Currently, you can't add empty directories to a tarball directly.
68You could add a temporary file within a directory, and then
69`remove()` the file.
70* If you delete a file, the empty directories it was located in
71stay in the tarball. You could try to `locate()` them and delete
72them. This will be fixed, though.
73* Filenames containing newlines are causing problems with the list
74iterators. To be fixed.
75* If you ask Archive::Tar::Wrapper to add a file to a tarball, it copies it into
76a temporary directory and then calls the system tar to wrap up that directory
77into a tarball.
78
79This approach has limitations when it comes to file permissions: If the file to
80be added belongs to a different user/group, Archive::Tar::Wrapper will adjust
81the uid/gid/permissions of the target file in the temporary directory to
82reflect the original file's settings, to make sure the system tar will add it
83like that to the tarball, just like a regular tar run on the original file
84would. But this will fail of course if the original file's uid is different
85from the current user's, unless the script is running with superuser rights.
86The tar program by itself (without Archive::Tar::Wrapper) works differently:
87It'll just make a note of a file's uid/gid/permissions in the tarball (which it
88can do without superuser rights) and upon extraction, it'll adjust the
89permissions of newly generated files if the -p option is given (default for
90superuser).
91
92# BUGS
93
94`Archive::Tar::Wrapper` doesn't currently handle filenames with embedded
95newlines.
96
97## Microsoft Windows support
98
99Support on Microsoft Windows is limited.
100
101Version below Windows 10 will not be supported for desktops, and for servers
102from Windows 2012 and above.
103
104The GNU `tar.exe` program doesn't work properly with the current interface of
105`Archive::Tar::Wrapper`.
106You must use the `bsdtar.exe` and make sure it appears first in the `PATH`
107environment variable than the GNU tar (if it is installed). See
108[http://libarchive.org/](http://libarchive.org/) for details about how to
109download and install `bsdtar.exe`, or go to
110[http://gnuwin32.sourceforge.net/packages.html](http://gnuwin32.sourceforge.net/packages.html)
111for a direct download.
112
113Windows 10 might come already with bsdtar program installed. Check
114[https://blogs.technet.microsoft.com/virtualization/2017/12/19/tar-and-curl-come-to-windows/](https://blogs.technet.microsoft.com/virtualization/2017/12/19/tar-and-curl-come-to-windows/)
115for more details.
116
117Having spaces in the path string to the `tar` program might be an issue too.
118Although there is some effort in terms of workaround it, you best might avoid it
119completely by installing in a different path than `C:\Program Files`.
120
121# LEGALESE
122
123This software is copyright (c) 2005 of Mike Schilli.
124
125This program is free software: you can redistribute it and/or modify it under
126the terms of the GNU General Public License as published by the Free Software
127Foundation, either version 3 of the License, or (at your option) any later
128version.
129
130This program is distributed in the hope that it will be useful, but WITHOUT ANY
131WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
132PARTICULAR PURPOSE. See the GNU General Public License for more details.
133
134You should have received a copy of the GNU General Public License along with
135Archive-Tar-Wrapper. If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).
136
137# AUTHOR
138
1392005, Mike Schilli <cpan@perlmeister.com>
140
141# MAINTAINER
142
1432018, Alceu Rodrigues de Freitas Junior <arfreitas@cpan.org>
144