I'm trying to set CHOWN to 0 so that when extracted as root the files aren't chown'd to the uid saved in the archive. This doesn't seem to work.
use Archive::Tar;
use Getopt::Long qw( :config pass_through );
my $tarballName = $ARGV[0];
my $testfix = Archive::Tar->new();
$testfix::CHOWN=0;
$testfix->read ($tarballName);
print "CHOWN=$testfix::CHOWN \n";
$testfix->extract()
The code above prints CHOWN=0, yet when I add print "CHOWN=$CHOWN \n"; to archive::tar.pm and run it I get :
CHOWN=0
CHOWN in tar.pm=1
Is this the correct way to change this setting?
You should set $Archive::Tar::CHOWN
, not $testfix::CHOWN
. Moreover, you declare $testfix
as an object, but later use it as a prefix - these two concepts are quite different!