NAME

Clearcase - Object oriented interface to Clearcase.

VERSION

Author

Andrew DeFaria <Andrew@DeFaria.com>

Revision

$Revision: 1.43 $

Created

Tue Dec 4 17:33:43 MST 2007

Modified

$Date: 2011/11/16 18:27:37 $

SYNOPSIS

Provides access to global Clearcase information in an object oriented manner as well as an interface to cleartool.

# Access some compile time global settings:
print "View Drive: $Clearcase::VIEW_DRIVE" . "\n";
print "Vob Tag Prefix: $Clearcase::VOBTAG_PREFIX" . "\n";

# Access some run time global information through the default object
print "Client: $Clearcase::CC->client" . "\n";
print "Region: $Clearcase::CC->region" . "\n";
print "Registry host: $Clearcase::CC->registry_host" . "\n";

# List all vobs using execute method of the default object";
my ($status, @vobs) = $Clearcase::CC->execute ("lsvob -s");

print $_ foreach (@vobs) if $status == 0 . "\n";

DESCRIPTION

This module, and others below the Clearcase directory, implement an object oriented approach to Clearcase. In general Clearcase entities are made into objects that can be manipulated easily in Perl. This module is the main or global module. Contained herein are members and methods of a general or global nature. Also contained here is an IPC interface to cleartool such that cleartool runs in the background and commands are fed to it via the execute method. When making repeated calls to cleartool this can result in a substantial savings of time as most operating systems' fork/execute sequence is time consuming. Factors of 8 fold improvement have been measured.

Additionally a global variable, $CC, is implemented from this module such that you should not need to instantiate another one, though you could.

ROUTINES

The following routines are exported:

formatOpts (%opts)

Format a hash of options into a string

Parameters:

%opts

Hash of options

Returns:

$opts

String of formatted options

formatOpts (%opts)

Format a hash of options into a string

Parameters:

%opts

Hash of options

Returns:

$opts

String of formatted options

setComment ($comment)

Format a comment string for cleartool or return -nc

Parameters:

$comment

The comment string

Returns:

$comment_opt

Formatted comment option (e.g. -c "foo" or -nc)

setComment ($comment)

Format a comment string for cleartool or return -nc

Parameters:

$comment

The comment string

Returns:

$comment_opt

Formatted comment option (e.g. -c "foo" or -nc)

vobname ($tag)

Given a vob tag, return the vob name by stripping of the VOBTAG_PREFIX properly such that you return just the unique vob name. This is tricky because Windows uses '\' as a VOBTAG_PREFIX. With '\' in there regex's like /$Clearcase::VOBTAG_PREFIX(.+)/ to capture the vob's name minus the VOBTAG_PREFIX fail because Perl evaluates this as just a single '\', which escapes the '(' of the '(.+)'!

Parameters:

    $tag

    Vob tag to convert

Returns:

    $name

    The unique part of the vob name

vobtag ($name)

Given a vob name, add the VOBTAG_PREFIX based on the current OS.

Parameters:

    $name

    Vob name to convert

Returns:

    $tag

    Vob tag

attributes ($type, $name)

Get any attributes attached to the $type:$name

Parameters:

    $type

    Type of object to look for attributes. For example, activity, baseline, etc.

    $name

    Object name to look for attributes.

Returns:

    %attributes

    Hash of attribute name/values

status ()

Returns the status of the last executed command.

Parameters:

    none

Returns:

    $status

    Status of the command last executed.

output ()

Returns the output of the last executed command.

Parameters:

    none

Returns:

    @output or $output

    If called in a list context, returns @output, otherwise returns $output.

execute ($cmd)

Sends a command to the cleartool coprocess. If not running a cleartool coprocess is started and managed. The coprocess is implemented as a coprocess using IPC for communication that will exist until the object is destroyed. Stdin and stdout/stderr are therefore pipes and can be fed. The execute method feeds the input pipe and returns status and output from the output pipe.

Using execute can speed up execution of repeative cleartool invocations substantially.

Parameters:

    $cmd

    Cleartool command to execute.

Returns:

    $status

    Status of the command last executed.

    @output

    Array of output lines from the cleartool command execution.

lastcmd()

Return last command attempted by execute

Parameters:

none

Returns:

Last command attempted by execute

new ()

Construct a new Clearcase object. Note there is already a default Clearcase object created named $cc. You should use that unless you have good reason to instantiate another Clearcase object.

Parameters:

none

Returns:

Clearcase object

client

Returns the client

Parameters:

none

Returns:

client

hardware_type

Returns the hardware_type

Parameters:

none

Returns:

hardware_type

license_host

Returns the license_host

Parameters:

none

Returns:

license_host

os

Returns the os

Parameters:

none

Returns:

os

region

Returns the region

Parameters:

none

Returns:

region

registry_host

Returns the registry_host

Parameters:

none

Returns:

client string

sitename

Returns the sitename

Parameters:

none

Returns:

sitename

version

Returns the version

Parameters:

none

Returns:

version

regions

Returns an array of regions in an array context or the number of regions in a scalar context

Parameters:

none

Returns:

array of regions or number of regions

pwv

Returns the current working view or undef if not in a view

Parameters:

none

Returns:

Current working view or undef if none

name2oid

Returns the oid for a given name

Parameters:

name

The name to convert (unless filesystem object it should contain a type:)

vob

The vob the name belongs to

Returns:

OID

oid2name

Returns the object name for the given oid

Parameters:

oid

The OID to convert

vob

The vob the OID belongs to

Returns:

String representing the OID's textual name/value

verbose_level

Returns the verbose_level

Parameters:

none

Returns:

verbose_level

quiet

Sets verbose_level to quiet

Parameters:

none

Returns:

none

noisy

Sets verbose_level to noisy

Parameters:

none

Returns:

none

DEPENDENCIES

Perl Modules

DEPENDENCIES

Modules

Clearcase
Clearcase::Vob

BUGS AND LIMITATIONS

There are no known bugs in this module

Please report problems to Andrew DeFaria <Andrew@DeFaria.com>.

COPYRIGHT AND LICENSE

Copyright (C) 2007-2026 by Andrew DeFaria <Andrew@DeFaria.com>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.38.0 or, at your option, any later version of Perl 5 you may have available.