Using File::Copy with ClearCase Views

T

Tony George

Hi,

I'm having a problem using the Copy module on a ClearCase view that's been
set as "readonly" (i.e. ct chview -readonly <view tag>). I want to copy a
file out of this view and put it in another directory that's outside of
ClearCase. The strange thing is that the copy command actually copies
correctly. The problem is that it returns a "0" errorcode because of the
fact that the view is readonly. I guess "copy" still tries to write
something to the view even though it's only doing a copy.

e.g.

....
my $ret = copy("$basepath/StdOutput/$file", "$stdout_dir/$file");
print "return is $ret. $!\n";
....

This returns:

... copying testfile.txt
return is 0. Read-only file system

The file "testfile.txt" is successfully copied to the correct location, but
I have some other things to do in the script based on the return code. The
"0" return code is messing that all up because the operation is in fact
successful.

The only solution I can think of is to just use a "system" command with Unix
"cp" (I'm on Solaris 8). I couldn't really figure out any other options
from just looking at the man pages.

Does anyone have other possible solutions or suggestions if I'm doing
something wrong?

Thanks...

Tony
 
J

Jim Gibson

Tony George said:
Hi,

I'm having a problem using the Copy module on a ClearCase view that's been
set as "readonly" (i.e. ct chview -readonly <view tag>).
[SNIP]


The only solution I can think of is to just use a "system" command with Unix
"cp" (I'm on Solaris 8). I couldn't really figure out any other options
from just looking at the man pages.

Does anyone have other possible solutions or suggestions if I'm doing
something wrong?

You are using the module File::Copy, right? I haven't used this, so
don't have any idea what your problem. I suggest if it is not working,
you just us system('cp ...') if that works. It will be a little slower,
because it does the copy in a subprocess. You could also ignore the
return code and check if the copy succeeded with a file operator, e.g.
-e to see if the copy exists, -s to get the size and compare with the
original. The code for File::Copy is on your system and is pure perl,
so maybe you can figure out what is wrong. But don't beat yourself up
if it is not working, just try something else. You could also try
contacting the authors of File::Copy.

Since comp.lang.perl is a defunct newsgroup, you might get better
response for general perl questions using comp.lang.perl.misc or, since
you are having a problem with a module, comp.lang.perl.modules
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top