#!/usr/bin/perl -slw use strict; use Archive::Tar; #use Data::Dumper::Concise; $Archive::Tar::FOLLOW_SYMLINK = 1; print $Archive::Tar::VERSION; my $t = Archive::Tar->new; $t->add_files('bar'); $t->write( 'baz.tgz', COMPRESS_GZIP ); $t->error(1); print "Done"; ls -l foo bar baz.tgz ls: cannot access baz.tgz: No such file or directory lrwxrwxrwx. 1 root root 3 Sep 15 19:35 bar -> foo -rw-r--r--. 1 root root 0 Sep 15 23:19 foo # perl z.tmp 1.78 Could not write data for: bar at z.tmp line 12 Done # echo "abcd" >foo # ls -l foo bar baz.tgz lrwxrwxrwx. 1 root root 3 Sep 15 19:35 bar -> foo -rw-r--r--. 1 root root 97 Sep 15 23:21 baz.tgz -rw-r--r--. 1 root root 5 Sep 15 23:20 foo # rm baz.tgz # perl z.tmp 1.78 Done ]# ls -l foo bar baz.tgz lrwxrwxrwx. 1 root root 3 Sep 15 19:35 bar -> foo -rw-r--r--. 1 root root 97 Sep 15 23:25 baz.tgz -rw-r--r--. 1 root root 5 Sep 15 23:20 foo And sometimes, I get # tar -tzvf baz.tgz -rw-r--r-- root/root 0 2011-09-15 19:35 bar tar: Skipping to next header tar: Exiting with failure status due to previous errors