David Boyce > IPC-ChildSafe-3.16 > IPC::ClearTool

Download:
IPC-ChildSafe-3.16.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View Bugs
Report a bug
Module Version: 3.16   Source  

NAME ^

IPC::ClearTool, ClearTool - run a bidirectional pipe to a cleartool process

SYNOPSIS ^

  use IPC::ClearTool;

  my $CT = IPC::ClearTool->new;
  $CT->cmd("pwv");
  $CT->cmd("lsview");
  $CT->cmd("lsvob -s");
  for ($CT->stdout) { print }
  $CT->finish;

ALTERNATE SYNOPSES ^

  use IPC::ClearTool;

  $rc = $CT->cmd("pwv");                # Assign return code to $rc

  $CT->notify;                          # "notify mode" is default;
  $rc = $CT->cmd("pwv");                # same as above

  $CT->store;                           # "Store mode" - hold stderr for
  $rc = $CT->cmd("pwv -X");             # later retrieval via $CT->stderr
  @errs = $CT->stderr;                  # Retrieve it now

  $CT->ignore;                          # Discard all stdout/stderr and
  $CT->cmd("pwv");                      # ignore nonzero return codes

  $CT->cmd("ls foo@@");                 # In void context, store stdout,
                                        # print stderr immediately,
                                        # exit on error.

  my %results = $CT->cmd("pwv");        # Place all results in %results,
                                        # available as:
                                        #   @{$results{stdout}}
                                        #   @{$results{stderr}}
                                        #   @{$results{status}}

  $CT->cmd();                           # Clear all accumulators

  $CT->stdout;                          # In void context, print stored output

DESCRIPTION ^

This module invokes the ClearCase 'cleartool' command as a child process and opens pipes to its standard input, output, and standard error. Cleartool commands may be sent "down the pipe" via the $CT->cmd() method. All stdout resulting from commands is stored in the object and can be retrieved at any time via the $CT->stdout method. By default, stderr from commands is sent directly to the real (parent's) stderr but if the store attribute is set as shown above, stderr will accumulate just like stdout and must be retrieved via $CT->stderr.

If $CT->cmd is called in a void context it will exit on error unless the ignore attribute is set, in which case all output is thrown away and error messages suppressed. If called in a scalar context it returns the exit status of the command. In a list context it returns a hash containing keys stdout, stderr, and <status>.

When used with no arguments and in a void context, $CT->cmd simply clears the stdout and stderr accumulators.

The $CT->stdout and $CT->stderr methods behave much like arrays; when used in a scalar context they return the number of lines currently stored. When used in a list context they return an array containing all currently stored lines, and then clear the internal stack.

The $CT->finish method ends the child process and returns its exit status.

This is only a summary of the documentation. There are more advanced methods for error detection, data return, etc. documented as part of IPC::ChildSafe. Note that IPC::ClearTool is simply a small subclass of ChildSafe; it provides the right defaults to the constructor for running cleartool and adds a few ClearCase-specific methods. In other ways it's identical to ChildSafe, and all ChildSafe documentation applies.

BUGS ^

AUTHOR ^

David Boyce dsbperl@cleartool.com

Copyright (c) 1997-2002 David Boyce. All rights reserved. This perl program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

perl(1), "perldoc IPC::ChildSafe"