Using File::Copy with ClearCase Views

Discussion in 'Perl' started by Tony George, Nov 12, 2003.

  1. Tony George

    Tony George Guest

    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
     
    Tony George, Nov 12, 2003
    #1
    1. Advertising

  2. Tony George

    Jim Gibson Guest

    In article <botm7o$hnt$>, Tony George
    <> wrote:

    > 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
     
    Jim Gibson, Nov 14, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mrunal

    Accessing ClearCase Mapped Drive using ASP.NET

    Mrunal, Nov 16, 2004, in forum: ASP .Net Security
    Replies:
    1
    Views:
    159
    Ken Schaefer
    Nov 16, 2004
  2. Maverick Ieong

    perl get crash when using ClearCase::CtCmd::exec

    Maverick Ieong, Nov 18, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    197
    Maverick Ieong
    Nov 18, 2004
  3. Maverick Ieong
    Replies:
    1
    Views:
    201
    Maverick Ieong
    Nov 24, 2004
  4. Replies:
    0
    Views:
    154
  5. Replies:
    4
    Views:
    240
    Andrew DeFaria
    Dec 27, 2006
Loading...

Share This Page