[Bio] / FigKernelScripts / svr_subsystem_roles.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/svr_subsystem_roles.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :     use strict;
3 :    
4 :     use Getopt::Long;
5 :     use SAPserver;
6 :     use ScriptThing;
7 :    
8 :     #
9 :     # This is a SAS Component.
10 :     #
11 :    
12 :     =head1 svr_subsystem_roles
13 :    
14 :     svr_subsystem_roles "subsystem ID" >sub_data.tbl
15 :    
16 :     Output the roles of a subsystem.
17 :    
18 :     This script takes as input a subsystem name on the command line and produces a
19 :     tab-delimited file of all the roles in the subsystem (in order) and their
20 :     abbreviations. Each line of the file will contain the abbreviation first and then
21 :     the full role name. The output will be produced on the standard output.
22 :    
23 :     Note that because the subsystem name likely contains spaces, it will need to be
24 :     enclosed in quotes on the command-line.
25 :    
26 :     =head2 Command-Line Options
27 :    
28 :     =over 4
29 :    
30 :     =item url
31 :    
32 :     The URL for the Sapling server, if it is to be different from the default.
33 :    
34 :     =item aux
35 :    
36 :     If specified, auxiliary roles will be included in the output. Normally these are
37 :     excluded.
38 :    
39 :     =back
40 :    
41 :     =cut
42 :    
43 :     # Parse the command-line options.
44 :     my $url = '';
45 :     my $aux;
46 :     my $opted = GetOptions('url=s' => \$url, aux => \$aux);
47 :     my $subID = $ARGV[0];
48 :     if (! $opted || ! $subID) {
49 :     print "usage: svr_subsystem_roles [--url=http://...] [--aux] \"subsystem name\" >output\n";
50 :     } else {
51 :     # Get the server object.
52 :     my $sapServer = SAPserver->new(url => $url);
53 :     # Get the roles.
54 :     my $subHash = $sapServer->subsystem_roles(-ids => $subID, -aux => $aux, -abbr => 1);
55 :     # Loop through them, producing output.
56 :     my $roles = $subHash->{$subID};
57 :     if (! $roles) {
58 :     print STDERR "Could not find \"$subID\".\n";
59 :     } else {
60 :     for my $role (@$roles) {
61 :     my ($roleID, $abbr) = @$role;
62 :     print "$abbr\t$roleID\n";
63 :     }
64 :     }
65 :     }
66 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3