summaryrefslogtreecommitdiff
path: root/cpan
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-10-13 20:32:28 +0100
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2011-10-13 20:32:28 +0100
commit1e91595577c5e985e96ac2212262825aeb0980fc (patch)
treed3ae188bbfbdcad4a69c87b486cdeba927ea9762 /cpan
parent3c3231932f4011ce8d5169183dd6da374d5aa696 (diff)
downloadperl-1e91595577c5e985e96ac2212262825aeb0980fc.tar.gz
Update Archive-Tar to CPAN version 1.80
[DELTA] * important changes in version 1.80 13/10/2011 - patch from Rocky Bernstein to add file chown() method [rt#71221]
Diffstat (limited to 'cpan')
-rw-r--r--cpan/Archive-Tar/lib/Archive/Tar.pm22
-rw-r--r--cpan/Archive-Tar/lib/Archive/Tar/Constant.pm2
-rw-r--r--cpan/Archive-Tar/lib/Archive/Tar/File.pm18
-rw-r--r--cpan/Archive-Tar/t/04_resolved_issues.t4
4 files changed, 43 insertions, 3 deletions
diff --git a/cpan/Archive-Tar/lib/Archive/Tar.pm b/cpan/Archive-Tar/lib/Archive/Tar.pm
index e279b44dba..65efb716bf 100644
--- a/cpan/Archive-Tar/lib/Archive/Tar.pm
+++ b/cpan/Archive-Tar/lib/Archive/Tar.pm
@@ -31,7 +31,7 @@ use vars qw[$DEBUG $error $VERSION $WARN $FOLLOW_SYMLINK $CHOWN $CHMOD
$DEBUG = 0;
$WARN = 1;
$FOLLOW_SYMLINK = 0;
-$VERSION = "1.78";
+$VERSION = "1.80";
$CHOWN = 1;
$CHMOD = 1;
$SAME_PERMISSIONS = $> == 0 ? 1 : 0;
@@ -70,6 +70,7 @@ Archive::Tar - module for manipulations of tar archives
$tar->rename('oldname', 'new/file/name');
$tar->chown('/', 'root');
$tar->chown('/', 'root:root');
+ $tar->chmod('/tmp', '1777');
$tar->write('files.tar'); # plain tar
$tar->write('files.tgz', COMPRESS_GZIP); # gzip compressed
@@ -1084,6 +1085,25 @@ sub rename {
return $entry->rename( $new );
}
+=head2 $tar->chmod( $file, $mode )
+
+Change mode of $file to $mode.
+
+Returns true on success and false on failure.
+
+=cut
+
+sub chmod {
+ my $self = shift;
+ my $file = shift; return unless defined $file;
+ my $mode = shift; return unless defined $mode && $mode =~ /^[0-7]{1,4}$/;
+ my @args = ("$mode");
+
+ my $entry = $self->_find_entry( $file ) or return;
+ my $x = $entry->chmod( @args );
+ return $x;
+}
+
=head2 $tar->chown( $file, $uname [, $gname] )
Change owner $file to $uname and $gname.
diff --git a/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm b/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
index 7a25f33412..a01963f098 100644
--- a/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
+++ b/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
@@ -3,7 +3,7 @@ package Archive::Tar::Constant;
BEGIN {
require Exporter;
- $VERSION = '1.78';
+ $VERSION = '1.80';
@ISA = qw[Exporter];
require Time::Local if $^O eq "MacOS";
diff --git a/cpan/Archive-Tar/lib/Archive/Tar/File.pm b/cpan/Archive-Tar/lib/Archive/Tar/File.pm
index b7000904fa..3b6e26db77 100644
--- a/cpan/Archive-Tar/lib/Archive/Tar/File.pm
+++ b/cpan/Archive-Tar/lib/Archive/Tar/File.pm
@@ -13,7 +13,7 @@ use Archive::Tar::Constant;
use vars qw[@ISA $VERSION];
#@ISA = qw[Archive::Tar];
-$VERSION = '1.78';
+$VERSION = '1.80';
### set value to 1 to oct() it during the unpack ###
my $tmpl = [
@@ -587,6 +587,22 @@ sub rename {
return 1;
}
+=head2 $bool = $file->chmod $mode)
+
+Change mode of $file to $mode. The mode can be a string or a number
+which is interpreted as octal whether or not a leading 0 is given.
+
+Returns true on success and false on failure.
+
+=cut
+
+sub chmod {
+ my $self = shift;
+ my $mode = shift; return unless defined $mode && $mode =~ /^[0-7]{1,4}$/;
+ $self->{mode} = oct($mode);
+ return 1;
+}
+
=head2 $bool = $file->chown( $user [, $group])
Change owner of $file to $user. If a $group is given that is changed
diff --git a/cpan/Archive-Tar/t/04_resolved_issues.t b/cpan/Archive-Tar/t/04_resolved_issues.t
index 7c4dd7c287..45b7a91557 100644
--- a/cpan/Archive-Tar/t/04_resolved_issues.t
+++ b/cpan/Archive-Tar/t/04_resolved_issues.t
@@ -110,6 +110,10 @@ use_ok( $FileClass );
ok( $tar->add_files( $in_file ),
" Added '$in_file'" );
+
+ ok( $tar->chmod( $in_file, '1777'),
+ " chmod 177 $in_file" );
+
ok( $tar->chown( $in_file, 'root' ),
" chown to root" );