in reply to Re: file copy
in thread file copy

I tried using File:NCopy,i.e, File::NCopy->new('set_permission' => "777")->copy($file,"$filename"); but still the permission of the destination file is "-r--r--r--".

Replies are listed 'Best First'.
Re^3: file copy
by gellyfish (Monsignor) on Apr 26, 2005 at 12:24 UTC

    You are asking the same question as you asked in file permissions using File::NCopy and you still haven't properly read and understand the documentation for File::NCopy, the set_permission option to the constructor takes a reference to a subroutine that takes two filenames as it's arguments - the first the one to get the permissions from, and the second one to apply the permissions to. If you really wanted to do that you probably want to do:

    File::NCopy->new('set_permission' => sub { chmod 0644 ,$_[1] })->copy( +$file,"$filename");
    but you probably don't want to use File::NCopy but use plain File::Copy and do chmod 0644, $filename after doing the copy.

    /J\

Re^3: file copy
by Transient (Hermit) on Apr 26, 2005 at 12:11 UTC
    If the file is not checked out, clearcase will not allow you to modify it. I'm not sure if File::Copy will return any error messages, but it wouldn't hurt to check. I'm not sure of the syntax (for File::Copy) either, so I can't really tell you if that's right.

    Perl also has chmod built in. Try copying with File::Copy and then
    chmod 0644, $file or warn "Unable to chmod $file!\n$!\n";
    or something similar.
      As you said i did File::NCopy->new('set_permission' => "777")->copy($filepath,"$filename"); and then chmod 0644, $filename; it works now.Thanks .
Re^3: file copy
by belg4mit (Prior) on Apr 26, 2005 at 12:11 UTC