On Mon Aug 04 19:38:47 2014, felipe@felipegasper.com wrote:
Show quoted text> tar archives are capable of storing “/foo/bar” literally -- i.e., with
> the leading slash -- but this module always strips out the slash.
>
When you say "are capable" of storing paths with a "leading slash", are you specifically referring to this (GNUtar) option?
#####
$ find /tmp/archive-tar-test/
/tmp/archive-tar-test/
/tmp/archive-tar-test/alpha
/tmp/archive-tar-test/alpha/foo
/tmp/archive-tar-test/beta
$ tar --create --verbose --absolute-names --file ~/Downloads/test_via_tar.tar /tmp/archive-tar-test/
/tmp/archive-tar-test/
/tmp/archive-tar-test/alpha/
/tmp/archive-tar-test/alpha/foo
/tmp/archive-tar-test/beta/
$ tar --list --absolute-names --file test_via_tar.tar
/tmp/archive-tar-test/
/tmp/archive-tar-test/alpha/
/tmp/archive-tar-test/alpha/foo
/tmp/archive-tar-test/beta/
#####
(I found that I had to use the '--absolute-names' option upon both creation and listing.)
Show quoted text> my $tar_obj = Archive::Tar->new();
> $tar_obj->add_data( '/foo', 'my data' );
> print Dumper $tar_obj->get_files();
>
> … and you’ll see that the prefix is stored as 'foo', not '/foo'.
>
> Even if you twiddle with the ::File object and set ->prefix('/foo'),
> write() will strip it out.