Clearcase

 view release on metacpan or  search on metacpan

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

=for html <blockquote>

=over

=item $view

The view tag to update info for

=back

=for html </blockquote>

Returns:

=for html <blockquote>

=over

=item nothing

=back

=for html </blockquote>

=cut

=pod

=head2 updateViewInfo ($view)

Updates the view info from cleartool lsview

Parameters:

=for html <blockquote>

=over

=item $view

The view tag to update info for

=back

=for html </blockquote>

Returns:

=for html <blockquote>

=over

=item nothing

=back

=for html </blockquote>

=cut

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

  my $region_opt = $self->{region} ? "-region $self->{region}" : "";

  my ($status, @output) = $Clearcase::CC->execute (
    "lsview $region_opt -long -properties -full $self->{tag}");

  return if $status;

  # Assuming this view is an empty shell of an object that the user may possibly
  # use the create method on, return our blessings...

  # No longer assume that. Could equally be the case where the view server
  # failed to respond. Carry on then...return if $status != 0;

  # Defaults
  $self->{type}              = 'dynamic';
  $self->{ucm}               = 0;
  $self->{additional_groups} = '';

  for (@output) {
    if (/Global path: (.*)/) {
      $self->{gpath} = $1;
    } elsif (/Server host: (.*)/) {
      $self->{shost} = $1;
    } elsif (/Region: (.*)/) {
      $self->{region} = $1;
    } elsif (/Active: (.*)/) {
      $self->{active} = ($1 eq 'YES') ? 1 : 0;
    } elsif (/View uuid: (.*)/) {
      $self->{uuid} = $1;
    } elsif (/View on host: (.*)/) {
      $self->{host} = $1;
    } elsif (/View server access path: (.*)/) {
      $self->{access_path} = $1;
    } elsif (/View attributes: (.*)/) {
      my $view_attributes = $1;
      $self->{type} =
          $view_attributes =~ /webview/  ? 'webview'
        : $view_attributes =~ /snapshot/ ? 'snapshot'
        :                                  'dynamic';
      $self->{ucm} =
        $view_attributes =~ /ucmview/
        ? 1
        : 0;
    } elsif (/Created (\S+) by (.+)/) {
      $self->{created_date} = $1;
      $self->{created_by}   = $2;
    } elsif (/Last modified (\S+) by (.+)/) {
      $self->{modified_date} = $1;
      $self->{modified_by}   = $2;
    } elsif (/Last accessed (\S+) by (.+)/) {
      $self->{accessed_date} = $1;
      $self->{accessed_by}   = $2;
    } elsif (/Last config spec update (\S+) by (.+)/) {
      $self->{cs_updated_date} = $1;
      $self->{cs_updated_by}   = $2;
    } elsif (/Text mode: (\S+)/) {
      $self->{text_mode} = $1;
    } elsif (/Properties: (.*)/) {

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


Returns:

=for html <blockquote>

=over

=item view space

=back

=for html </blockquote>

=cut

  $self->updateViewSpace unless ($self->{viewSpace});

  return $self->{viewSpace};
}    # viewSpace

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

=pod

=head1 viewSpacePct

Returns the view database percent for this view.

Parameters:

=for html <blockquote>

=over

=item none

=back

=for html </blockquote>

Returns:

=for html <blockquote>

=over

=item view space percent

=back

=for html </blockquote>

=cut

  $self->updateViewSpace unless ($self->{viewSpacePct});

  return $self->{viewSpacePct};
}    # viewSpacePct

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

  my ($status, @output) = $Clearcase::CC->execute (
    "space -region $self->{region} -view $self->{tag}");

  $self->{viewPrivateStorage}    = 0.0;
  $self->{viewPrivateStoragePct} = '0%';
  $self->{viewAdmin}             = 0.0;
  $self->{viewAdminPct}          = '0%';
  $self->{viewDatabase}          = 0.0;
  $self->{viewDatabasePct}       = '0%';
  $self->{viewSpace}             = 0.0;
  $self->{viewSpacePct}          = '0%';

  for (@output) {
    if (/\s*(\S+)\s*(\S+)\s*View private storage/) {
      $self->{viewPrivateStorage}    = $1;
      $self->{viewPrivateStoragePct} = $2;
    } elsif (/\s*(\S+)\s*(\S+)\s*View database/) {
      $self->{viewDatabase}    = $1;
      $self->{viewDatabasePct} = $2;
    } elsif (/\s*(\S+)\s*(\S+)\s*View administration/) {
      $self->{viewAdmin}    = $1;
      $self->{viewAdminPct} = $2;
    } elsif (/\s*(\S+)\s*(\S+)\s*Subtotal/) {
      $self->{viewSpace}    = $1;
      $self->{viewSpacePct} = $2;
    }    # if
  }    # for

  return;
}    # updateViewSpace

1;

=pod

=head2 DEPENDENCIES

=head2 Modules

=over

=item L<Clearcase|Clearcase>

=back

=head2 INCOMPATABILITIES

None

=head2 BUGS AND LIMITATIONS

There are no known bugs in this module.

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

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2020 by Andrew@DeFaria.com



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