Archive-Tar-Wrapper-IPC-Cmd
view release on metacpan or search on metacpan
lib/Archive/Tar/Wrapper/IPC/Cmd.pm view on Meta::CPAN
my($self, $rel_path, $path_or_stringref, $opts) = @_;
if($opts) {
if(!ref($opts) or ref($opts) ne 'HASH') {
LOGDIE "Option parameter given to add() not a hashref.";
}
}
my $perm = $opts->{perm} if defined $opts->{perm};
my $uid = $opts->{uid} if defined $opts->{uid};
my $gid = $opts->{gid} if defined $opts->{gid};
my $binmode = $opts->{binmode} if defined $opts->{binmode};
my $target = File::Spec->catfile($self->{tardir}, $rel_path);
my $target_dir = dirname($target);
if( ! -d $target_dir ) {
if( ref($path_or_stringref) ) {
$self->add( dirname( $rel_path ), dirname( $target_dir ) );
} else {
$self->add( dirname( $rel_path ), dirname( $path_or_stringref ) );
lib/Archive/Tar/Wrapper/IPC/Cmd.pm view on Meta::CPAN
} else {
copy $path_or_stringref, $target or
LOGDIE "Can't copy $path_or_stringref to $target ($!)";
}
if(defined $uid) {
chown $uid, -1, $target or
LOGDIE "Can't chown $target uid to $uid ($!)";
}
if(defined $gid) {
chown -1, $gid, $target or
LOGDIE "Can't chown $target gid to $gid ($!)";
}
if(defined $perm) {
chmod $perm, $target or
LOGDIE "Can't chmod $target to $perm ($!)";
}
if(!defined $uid and
!defined $gid and
!defined $perm and
!ref($path_or_stringref)) {
perm_cp($path_or_stringref, $target) or
LOGDIE "Can't perm_cp $path_or_stringref to $target ($!)";
}
1;
}
######################################
( run in 1.155 second using v1.01-cache-2.11-cpan-5735350b133 )