Various changes and additions for UCM and testing things
[clearscm.git] / lib / Clearcase / UCM / Streams.pm
1 =pod
2
3 =head1 NAME $RCSfile: Stream.pm,v $
4
5 Object oriented interface to UCM Streams
6
7 =head1 VERSION
8
9 =over
10
11 =item Author
12
13 Andrew DeFaria <Andrew@ClearSCM.com>
14
15 =item Revision
16
17 $Revision: 1.8 $
18
19 =item Created
20
21 Fri May 14 18:16:16 PDT 2010
22
23 =item Modified
24
25 $Date: 2011/11/15 02:00:58 $
26
27 =back
28
29 =head1 SYNOPSIS
30
31 Provides access to information about Clearcase Streams.
32
33   my $stream = new Clearcase::UCM::Streams()
34
35 =head1 DESCRIPTION
36
37 This module implements a UCM Streams object
38
39 =head1 ROUTINES
40
41 The following routines are exported:
42
43 =cut
44
45 package Clearcase::UCM::Streams;
46
47 use strict;
48 use warnings;
49
50 sub new ($) {
51   my ($class, $pvob) = @_;
52
53 =pod
54
55 =head2 new
56
57 Construct a new Clearcase Streams object
58
59 Parameters:
60
61 =for html <blockquote>
62
63 =over
64
65 =item pvob
66
67 Pvob object
68
69 =back
70
71 =for html </blockquote>
72
73 Returns:
74
75 =for html <blockquote>
76
77 =over
78
79 =item Clearcase Streams object
80
81 =back
82
83 =for html </blockquote>
84
85 =cut
86
87   my ($status, @output) =
88     $clearcase::CC->execute('lsstream -short -invob ' . $pvob->tag;
89
90   my $class = bless {
91     streams => @output,
92   }, $class; # bless
93     
94   return $class; 
95 } # new
96   
97 sub streams () {
98   my ($self) = @_;
99     
100 =pod
101
102 =head2 streams
103
104 Return a list of stream names in an array context or the number of streams in 
105 a scalar context.
106
107 Parameters:
108
109 =for html <blockquote>
110
111 =over
112
113 =item none
114
115 =back
116
117 =for html </blockquote>
118
119 Returns:
120
121 =for html <blockquote>
122
123 =over
124
125 =item List of streams or number of streams
126
127 Array of stream names in an array context or the number of streams in a scalar
128 context.
129
130 =back
131
132 =for html </blockquote>
133
134 =cut
135
136   if (wantarray) {
137     return $self->{streams} ? sort @{$self->{streams}) : ();
138   } else {
139     return $self->{streams} ? scalar @{$self->{streams});
140   } # if
141 } # streams
142
143 1;
144
145 =head1 DEPENDENCIES
146
147 =head2 ClearSCM Perl Modules
148
149 =for html <p><a href="/php/scm_man.php?file=lib/Clearcase.pm">Clearcase</a></p>
150
151 =head1 INCOMPATABILITIES
152
153 None
154
155 =head1 BUGS AND LIMITATIONS
156
157 There are no known bugs in this module.
158
159 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
160
161 =head1 LICENSE AND COPYRIGHT
162
163 Copyright (c) 2007, ClearSCM, Inc. All rights reserved.
164
165 =cut