This file is indexed.

/usr/share/perl5/Bio/GMOD/Config.pm is in libchado-perl 1.22-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
package Bio::GMOD::Config;
use strict;

=head1 NAME

Bio::GMOD::Config -- a GMOD utility package for reading config files

=head1 SYNOPSIS

    $ export GMOD_ROOT=/usr/local/gmod
    
    my $conf    = Bio::GMOD::Config->new();
    my $tmpdir  = $conf->tmpdir();
    my $confdir = $conf->confdir();
    my $version = $conf->version();

    my @dbnames = $conf->available_dbs();

=head1 DESCRIPTION

Bio::GMOD::Config is a module to allow programmatic access to the configuration
files in GMOD_ROOT/conf.  Typically, these files will be gmod.conf 
(containing site-wide parameters), and one each configuration file for
each database, named dbname.conf, containing database connection parameters,
which are accessed through Bio::GMOD::Config::DB objects.

=head1 METHODS

=cut

use File::Spec::Functions qw/ catdir catfile /;

=head2 new

 Title   : new
 Usage   : my $config = Bio::GMOD::Config->new('/path/to/gmod');
 Function: create new Bio::GMOD::Config object
 Returns : new Bio::GMOD::Config
 Args    : optional path to gmod installation
 Status  : Public

Takes one optional argument that is the path to the root of the GMOD 
installation.  If that argument is not provided, Bio::GMOD::Config will
fall back to the environment variable GMOD_ROOT, which should be defined
for any GMOD installation.

=cut


sub new {
    my $self = shift;
    my $arg  = shift;

    my $root;
    if ($arg) {
        $root = $arg; #can override the environment variable
    } else {
        $root = $ENV{'GMOD_ROOT'};  #required
    }

    die "Please set the GMOD_ROOT environment variable\n"
       ."It is required from proper functioning of gmod" unless ($root);

    my $confdir = catdir($root, 'conf'); #not clear to me what should be in
                                      #gmod.conf since db stuff should go in
                                      #db.conf (per programmers guide)

    my @db;
    opendir CONFDIR, $confdir
       or die "couldn't open $confdir directory for reading:$!\n";
    my $dbname;
    while (my $dbfile = readdir(CONFDIR) ) {
        if ($dbfile =~ /^(\w+)\.conf/) {
            push @db, $1;
        } else {
            next;
        }
    }
    closedir CONFDIR;

    my %conf;
    my $conffile = catfile($confdir, 'gmod.conf');
    open CONF, $conffile or die "Unable to open $conffile: $!\n";
    while (<CONF>) {
        next if /^\#/;
        if (/(\w+)\s*=\s*(\S.*)$/) {
            $conf{$1}=$2;
        }
    }
    close CONF;

    return bless {db       => \@db,
                  conf     => \%conf,
                  confdir  => $confdir,
                  gmod_root=> $root}, $self;
}

=head2 available_dbs

 Title   : available_dbs
 Usage   : my @dbs = $config->available_dbs();
 Function: returns a list of database config files
 Returns : see above
 Args    : none
 Status  : public

This method returns reference to a list of database configuration
files available in GMOD_ROOT/conf.

=cut


sub available_dbs {
    shift->{'db'};
}

=head2 all_tags
                                                                                
 Title   : all_tags
 Usage   : @tags = $config->all_tags();
 Function: returns a list of parameters (ie, hash keys) for a given database
 Returns : see above
 Args    : none
 Status  : public
                                                                                
Returns a list of database connection parameters (ie, hash keys) for
a given database configuration file.
                                                                                
=cut

sub all_tags {
    my $self = shift;
                                                                                
    my $params = $self->{'conf'};
    my @params;
    foreach (keys %$params) {
        push @params, $_;
    }
    return @params;
}

=head2 has_tag

 Title   : has_tag
 Usage   : $bool = $conf->has_tag('TMP');
 Function: Returns true if the tag is contained in the config file
 Returns : see above
 Args    : name of tag
 Status  : public

=cut

sub has_tag{
    my $self = shift;
    my $tag  = shift;

    my $conf = $self->{'conf'};
    if (defined $$conf{$tag}) {
        return 1;
    } else {
        return 0;
    }
}

=head2 get_tag_value

 Title   : get_tag_value 
 Usage   : $value = $conf->get_tag_value($tag);
 Function: return the value of a config parameter
 Returns : see above
 Args    : name of a tag
 Status  : Public
                                                                                
=cut

sub get_tag_value {
    my $self = shift;
    my $tag  = shift;

    my $conf = $self->{'conf'};
    if (defined $$conf{$tag}) {
        return $$conf{$tag};
    } else {
        return;
    }
}

=head2 confdir

 Title   : confdir
 Usage   : $confdir = $config->confdir();
 Function: returns the path to the configuration directory
 Returns : see above
 Args    : none
 Status  : public


=cut


sub confdir {
    shift->{'confdir'};
}

=head2 version

 Title   : version
 Usage   : $version = $config->version();
 Function: returns the version of the currently installed Chado software
 Returns : see above
 Args    : none
 Status  : public


=cut


sub version {
    shift->get_tag_value('VERSION');;
}


=head2 tmp

 Title   : tmp
 Usage   : $tmpdir = $config->tmpdir();
 Function: returns the path to the GMOD tmp directory
 Returns : see above
 Args    : none
 Status  : public

Returns the path to the GMOD tmp directory.

=cut


sub tmpdir {
    shift->get_tag_value('TMP');
}

=head2 gmod_root 
                                                                                
 Title   : gmod_root
 Usage   : $gmod_root = $config->gmod_root();
 Function: returns the path to the GMOD root directory
 Returns : see above
 Args    : none
 Status  : public
                                                                                
Returns the path to the GMOD root directory.

=cut

sub gmod_root {
    shift->{'gmod_root'};
}

1;

=head1 AUTHOR
                                                                                
Scott Cain E<lt>scain@cpan.orgE<gt>.
                                                                                
Copyright (c) 2011 Cold Spring Harbor Laboratory
                                                                                
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
                                                                                
=cut