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

View of /FigKernelScripts/svr_subsystem_roles.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Wed Aug 11 20:36:18 2010 UTC (9 years, 5 months ago) by parrello
Branch: MAIN
CVS Tags: rast_rel_2010_0928, mgrast_dev_02212011, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2011_0119, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_dev_04012011, rast_rel_2010_0827, myrast_33, mgrast_dev_04052011, mgrast_dev_02222011
subsystem download scripts.

#!/usr/bin/perl -w
use strict;

use Getopt::Long;
use SAPserver;
use ScriptThing;

#	This is a SAS Component.

=head1 svr_subsystem_roles

    svr_subsystem_roles "subsystem ID" >sub_data.tbl

Output the roles of a subsystem.

This script takes as input a subsystem name on the command line and produces a
tab-delimited file of all the roles in the subsystem (in order) and their
abbreviations. Each line of the file will contain the abbreviation first and then
the full role name. The output will be produced on the standard output.

Note that because the subsystem name likely contains spaces, it will need to be
enclosed in quotes on the command-line.

=head2 Command-Line Options

=over 4

=item url

The URL for the Sapling server, if it is to be different from the default.

=item aux

If specified, auxiliary roles will be included in the output. Normally these are



# Parse the command-line options.
my $url = '';
my $aux;
my $opted =  GetOptions('url=s' => \$url, aux => \$aux);
my $subID = $ARGV[0];
if (! $opted || ! $subID) {
    print "usage: svr_subsystem_roles [--url=http://...] [--aux] \"subsystem name\" >output\n";
} else {
    # Get the server object.
    my $sapServer = SAPserver->new(url => $url);
    # Get the roles.
    my $subHash = $sapServer->subsystem_roles(-ids => $subID, -aux => $aux, -abbr => 1);
    # Loop through them, producing output.
    my $roles = $subHash->{$subID};
    if (! $roles) {
        print STDERR "Could not find \"$subID\".\n";
    } else {
        for my $role (@$roles) {
            my ($roleID, $abbr) = @$role;
            print "$abbr\t$roleID\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3