|
Attache - Perl extension for interfacing to attcmd on WIn32 |
Attache - Perl extension for interfacing to attcmd on WIn32
use Attache;
# Create
my $a=Attache->new('alfo_webteam');
# Run a command
$a->lsws() or warn("Problems on lsws");
# Check errors, warnings, output
if($attache->hasErrors()) {
print STDOUT
"completed, with ERRORS:\n",
join("\n", $attache->errors()),"\n";
}
if($attache->hasWarnings()) {
print STDOUT
"completed, with WARNINGS:\n",
join("\n", $attache->warnings()),"\n";
}
print STDOUT "Output:\n",join("\n",$attache->lastoutput()),"\n";
Attache.pm is an OO interface to the ClearCase CLI facility on Win32 systems (attcmd). You need attcmd installed to be able to use this module.
new($ws,[$attcmd])getWs()setWs($ws)vault()
my $a=Attache->new("alfo_dev7");
print $a->vault(),"\n";
# prints F:\home\alf\ClearCase\alfo_dev7 on my machine
lastoutput()hasErrors()errors()hasWarnings()warnings()
my $a=Attache->new("alfo_dev7");
$a->co(' -c "None of your business" /tt_vob/foo/bar/baz.cpp');
Arguments are processed by the shell, so caution with quoting, special characters etc. should be exercised. DO NOT include any workspace indication - it is automatically inserted.
Please consult the attache documentation to find out which commands are supported.
setlog($path,[$appendflag])
$a->setlog(undef)
Disables logging.
None
Just drop in any directory of your INCLUDE path, or read the FindBin docs and do something along the lines of:
use FindBin qw($Bin); use lib ($Bin,"$Bin/../perl/lib", "$Bin/../lib/perl","$Bin/../lib"); # use Attache;
Tested with perl 5.6 (ActiveState build 623) on Windows NT. For Unix, check the Clearcase wrapper on the nearest CPAN site (http://search.cpan.org/search?mode=module&query=Clearcase).
Lesser perl versions may work (I'm almost positive about 5.5). Windowze (non-NT) may also work, but I doubt it, as command.com is even more broken than cmd.exe .
No effort is made to ensure workspace validity. Setlog should accept filehandle objects, and it should be possible to log directly to STDOUT or STDERR.
Due to the cretin way in which cmd.exe handles command line quoting, some combinations of (legitimate) arguments may break Attache - when this happens, please direct your grievances to:
Microsoft Corp., Redmond, WA, U.S.A.
Every command starts a new attcmd.exe. If anybody knows a way to use attcmd over a pipe (or a COM interface, or something else) pls. let me know.
Alessandro Forghieri, alf@orion.it
The attache documentation, perl(1).
This code is released under the No-Copyright provisions of the GNU Public License
|
Attache - Perl extension for interfacing to attcmd on WIn32 |