Example: Displaying information about all branches that sprout from a version (Perl)

# The syntax used here was compatible with ActiveState build 522.

use Win32::OLE;

# Connect to the top-level Rational ClearCase object
my $cc = Win32::OLE->new('ClearCase.Application')
     or die "Could not create Application object\n";

# Loop over the branches sprouting from a version and display their
# paths using the default property of ICCBranch, and other information

my $ver = $cc->Version("b:\\caroltest\\testelem.c@@\\main\\0")
     or die("Could not get version: ", Win32::OLE->LastError(), "\n");
my $path = $ver->Path;
my $subbranches = $ver->SubBranches;
my $enum = Win32::OLE::Enum->new($subbranches);

while (defined(my $branch = $enum->Next)) {
     print($branch->Path, " branch sprouting from ", $path, " has ",
          $branch->Versions->Count, " version(s); latest version is ",
          $branch->LatestVersion->VersionNumber, "\n");
}

Feedback