Madam has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: file copy
by belg4mit (Prior) on Apr 26, 2005 at 11:57 UTC
      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--".

        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\

        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.
Re: file copy
by Transient (Hermit) on Apr 26, 2005 at 11:54 UTC
    You need to check the file out either unreserved or reserved. i.e. cleartool co [-unr] file

    Then you can do with it what you will.

    Not really sure how this is related to Perl, but uhmm...

    perl -le '`cleartool co -unr file`'
    for grins :) (code untested)

    Oh and then simply chmod 644 (or, in Perl: chmod 0644) the file