3 =head1 NAME $RCSfile: Views.pm,v $
5 Object oriented interface to Clearcase Views
13 Andrew DeFaria <Andrew@ClearSCM.com>
21 Dec 29 12:07:59 PST 2005
25 $Date: 2011/11/16 19:46:13 $
31 Provides access to information about Clearcase Views.
33 my $views = new Clearcase::Views;
35 my $nbr_views = $views->views;
36 my @view_list = $views->views;
38 display "Clearcase Views\n";
40 display "Number of views:\t\t" . $nbr_views;
41 display "View list:\n";
43 display "\t$_" foreach (@view_list);
47 This module implements an object oriented interface to Clearcase
52 The following routines are exported:
56 package Clearcase::Views;
64 my ($class, $region) = @_;
70 Construct a new Clearcase Views object.
74 =for html <blockquote>
82 =for html </blockquote>
86 =for html <blockquote>
90 =item Clearcase Views object
94 =for html </blockquote>
98 $region ||= $Clearcase::CC->region;
100 my ($status, @output) =
101 $Clearcase::CC->execute ("lsview -short -region $region");
117 Return a list of view tags in an array context or the number of views in
122 =for html <blockquote>
130 =for html </blockquote>
134 =for html <blockquote>
138 =item List of views or number of views
140 Array of view tags in an array context or the number of views in a scalar context.
144 =for html </blockquote>
149 return $self->{views} ? sort @{$self->{views}} : ();
151 return $self->{views} ? scalar @{$self->{views}} : 0;
162 Return the number of dynamic views
166 =for html <blockquote>
174 =for html </blockquote>
178 =for html <blockquote>
182 =item number of dynamic views
184 Returns the number of dynamic views in the region
188 =for html </blockquote>
192 $self->updateViewInfo if !defined $self->{dynamic};
193 return $self->{dynamic};
203 Return the number of ucm views
207 =for html <blockquote>
215 =for html </blockquote>
219 =for html <blockquote>
223 =item number of ucm views
225 Returns the number of ucm views in the region
229 =for html </blockquote>
233 $self->updateViewInfo if !defined $self->{ucm};
244 Return the number of snapshot views
248 =for html <blockquote>
256 =for html </blockquote>
260 =for html <blockquote>
264 =item number of snapshot views
266 Returns the number of snapshot views in the region
270 =for html </blockquote>
274 $self->updateViewInfo if !defined $self->{snapshot};
275 return $self->{snapshot};
285 Return the number of web views
289 =for html <blockquote>
297 =for html </blockquote>
301 =for html <blockquote>
305 =item number of web views
307 Returns the number of web views in the region
311 =for html </blockquote>
315 $self->updateViewInfo if !defined $self->{web};
319 sub updateViewInfo ($) {
322 my ($dynamic, $web, $ucm, $snapshot) = (0, 0, 0, 0);
324 foreach ($self->views) {
325 my ($status, @lsview_out) = $Clearcase::CC->execute ("lsview -properties -full $_");
330 foreach (@lsview_out) {
335 if /snapshot/ and not /webview/;
344 $self->{dynamic} = $dynamic;
347 $self->{snapshot} = $snapshot;
357 =for html <p><a href="/php/cvs_man.php?file=lib/Clearcase.pm">Clearcase</a></p>
359 =head1 INCOMPATABILITIES
363 =head1 BUGS AND LIMITATIONS
365 There are no known bugs in this module.
367 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
369 =head1 LICENSE AND COPYRIGHT
371 Copyright (c) 2007, ClearSCM, Inc. All rights reserved.