I am trying to run the following code, but the got #error 1
at startview
command, and #error 2
in desc
command.
use Win32::OLE;
$ct = Win32::OLE->new('ClearCase.ClearTool') or die "Could not create ClearTool object\n";
$view = "ccadm01_UARK_DEV";
$output = $ct->CmdExec("pwv") or die("Cleartool returned error: ", Win32::OLE->LastError(), "\n");
print ("pwv \$output = $output\n");
# error 1 : cleartool return error 0
$output = $ct->CmdExec("startview ccadm01_UARK_DEV") or die("Cleartool returned error: ", Win32::OLE->LastError(), "\n");
$CWD = $view_dir;
print( "Current directory: $CWD\n");
# error 2: No view context available
$output = $ct->CmdExec("describe -fmt \"%[versions]Cp\" activity:USR0200004985\@\\Unix_PVOB") or die("Cleartool returned error: ", Win32::OLE->LastError(), "\n");
print ("desc \$output = $output\n");
For #error 1, I tried the same command from DOS, it works.
You need to make sure your $view
is a valid dynamic view tag for cleartool startview
to work.
(make sure to not use cleartool setview
, as it spawns a subshell)
Also if it returns error 0, you can assume it has worked: CAL might return an "error", but status 0 should mean the command has been executed.
An error different from 0, though, means something went wrong.
And you need to cd
into that view (/view/<viewTag>
or m:\<viewTag>
) for a cleartool descr
to work.
That one, executed in the wrong folder, is supposed to fail, hence "error 2".
The OP Jirong Hu points in the comments to Using Perl with Rational ClearCase Automation Library (CAL) and this script as an example.
来源:https://stackoverflow.com/questions/35236379/clearcase-cleartool-returns-no-view-context-available-error