Clearcase

 view release on metacpan or  search on metacpan

lib/Clearcase/Element.pm  view on Meta::CPAN


=back

=for html </blockquote>

=cut

  $comment = Clearcase::setComment $comment;

  return $Clearcase::CC->execute ("checkout $comment $self->{pname}");
}    # checkout

sub checkin (;$) {
  my ($self, $comment) = @_;

=pod

=head2 checkin

Checks in the element

Parameters:

=for html <blockquote>

=over

=item comment

Check in comment. Default -nc.

=back

=for html </blockquote>

Returns:

=for html <blockquote>

=over

=item $status

Status from cleartool

=item @output

Ouput from cleartool

=back

=for html </blockquote>

=cut

  $comment = Clearcase::setComment $comment;

  return $Clearcase::CC->execute ("checkin $comment $self->{pname}");
}    # checkout

sub updateElementInfo () {
  my ($self) = @_;

  # Get all information that can be gotten using -fmt
  my $fmt =
      'Attributes:%aEndAttributes:'
    . 'Comment:%cEndComment:'
    . 'Create_date:%dEndCreate_date:'
    . 'Group:%[group]pEndGroup:'
    . 'Labels:%NlEndLabels:'
    . 'Pred:%PSnEndPred:'
    . 'Type:%[type]pEndType:'
    . 'ObjectKind:%mEndObjectKind:'
    . 'User:%[owner]pEndUser:'
    . 'Xname:%XnEndXname:';

  my ($status, @output) =
    $Clearcase::CC->execute ("describe -fmt \"$fmt\" $self->{pname}");

  return
    unless $status == 0;

  # We need to make sure that fields are filled in or empty because we are using
  # undef as an indication that we have not called updateElementInfo yet.
  $self->{attributes} = $self->{labels} =
    ();

  $self->{comments} = $self->{create_date} = $self->{group} = $self->{pred} =
    $self->{type} = $self->{objkind} = $self->{user} = $self->{xname} = '';

  foreach (@output) {

    # This output is wrapped with parenthesis...
    if (/Attributes:\((.*)\)EndAttributes:/) {
      my @attributes = split ", ", $1;
      my %attributes;

      foreach (@attributes) {
        if (/(\w+)=(\w+)/) {
          $attributes{$1} = $2;
        }    # if
      }    # foreach

      $self->{attributes} = %attributes ? \%attributes : ();
    }    # if

    if (/Comments:(.*)EndComments:/) {
      $self->{comments} = $1;
    }    # if

    if (/Create_date:(.*)EndCreate_date:/) {
      $self->{create_date} = $1;
    }    # if

    if (/Group:(.*)EndGroup:/) {
      $self->{group} = $1;
    }    # if

    if (/Labels:(.*)EndLabels:/) {
      my @labels = split " ", $1;
      $self->{labels} = @labels ? \@labels : ();



( run in 0.421 second using v1.01-cache-2.11-cpan-df04353d9ac )