5 =head1 NAME $RCSfile: ccdb.pl,v $
7 Request Clearcase metadata from CCDB
15 Andrew DeFaria <Andrew@ClearSCM.com>
23 Fri Mar 11 19:09:52 PST 2011
27 $Date: 2011/05/05 18:33:33 $
33 Usage ccdb.pl: [-u|sage] [-ve|rbose] [-deb|ug]
34 [-h|ost <host>] [-p|ort <port>] [<cmd>]
37 -u|sage: Displays usage
40 -deb|ug: Output debug messages
42 -h|ost <host>: Host to contact (Default: localhost)
43 -p|ort <port>: Port to connect to (Default: 25327)
44 <requests> Request to perform
48 This script exercises the ccdbserver.pl daemon by requesting Clearcase metadata
49 from the remote host:port that the ccdbserver.pl daemon is running on.
51 Requests are of the variety:
63 use lib "$FindBin::Bin/lib", "$FindBin::Bin/../lib";
69 my $VERSION = '$Revision: 1.4 $';
70 ($VERSION) = ($VERSION =~ /\$Revision: (.*) /);
72 my $me = $FindBin::Script;
79 sub DisplayOutput ($$) {
80 my ($status, $output) = @_;
83 error "Unable to service request (Status: $status)";
84 display join "\n", @$output;
86 if (ref $output eq 'HASH') {
87 foreach (keys %$output) {
88 display "$_:$$output{$_}";
90 } elsif (ref $output eq 'ARRAY') {
98 $data .= $rec{$_} ? $rec{$_} : '';
105 display_nolf scalar @$output;
106 display_nolf ' record';
107 display_nolf 's' if @$output > 1;
108 display ' qualified';
117 display_nolf "CCDB:";
119 my $request = <STDIN>;
123 last if $request =~ /^exit|^quit/i;
125 my ($status, $output) = $CCDBService->execute ($request);
127 DisplayOutput ($status, $output);
129 last if $request =~ /stopserver/i;
137 'usage' => sub { Usage },
138 'verbose' => sub { set_verbose },
139 'debug' => sub { set_debug },
140 'host=s' => \$CCDBService::OPTS{CCDB_HOST},
141 'port=s' => \$CCDBService::OPTS{CCDB_PORT},
142 ) or Usage "Invalid parameter";
144 my $request = join ' ', @ARGV;
146 display "$FindBin::Script V$VERSION";
148 $CCDBService = CCDBService->new;
150 my ($status, $output);
152 $status = $CCDBService->connectToServer (
153 $CCDBService::OPTS{CCDB_HOST},
154 $CCDBService::OPTS{CCDB_PORT}
157 error 'Unable to connect to '
158 . "$CCDBService::OPTS{CCDB_HOST}:$CCDBService::OPTS{CCDB_PORT}", 1
161 if ($request ne '') {
162 ($status, $output) = $CCDBService->execute ($request);
164 DisplayOutput $status, $output;
171 =head1 CONFIGURATION AND ENVIRONMENT
173 DEBUG: If set then $debug is set to this level.
175 VERBOSE: If set then $verbose is set to this level.
177 TRACE: If set then $trace is set to this level.
185 L<Getopt::Long|Getopt::Long>
187 =head2 ClearSCM Perl Modules
200 <a href="http://clearscm.com/php/cvs_man.php?file=clearadm/lib/Clearexec.pm">Clearexec</a><br>
201 <a href="http://clearscm.com/php/cvs_man.php?file=lib/Display.pm">Display</a><br>
202 <a href="http://clearscm.com/php/cvs_man.php?file=lib/Utils.pm">Utils</a><br>
207 =head1 BUGS AND LIMITATIONS
209 There are no known bugs in this script
211 Please report problems to Andrew DeFaria <Andrew@ClearSCM.com>.
213 =head1 LICENSE AND COPYRIGHT
215 Copyright (c) 2010, Tellabs, Inc. All rights reserved.