File: config.PLS

package info (click to toggle)
libchado-perl 1.31-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 44,716 kB
  • sloc: sql: 282,721; xml: 192,553; perl: 25,524; sh: 102; python: 73; makefile: 57
file content (89 lines) | stat: -rwxr-xr-x 2,528 bytes parent folder | download | duplicates (5)
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
#!perl -w

use Config;
use File::Basename qw(&basename &dirname);
use FindBin '$Bin';
use Cwd;


$origdir = cwd;
chdir dirname($0);
$file = basename($0, '.PL','.PLS');
$file = "gmod_$file.pl";

my %OPTIONS;
if (open F,"$Bin/../../build.conf") {
  while (<F>) {
    next if /^\#/;
    chomp;
    $OPTIONS{$1} = $2 if /^(\w+)\s*=\s*(.+)/;
  }
  close F;
}


open OUT,">$file" or die "Can't create $file: $!";
print OUT "$Config{startperl} -w\n";

if ($OPTIONS{LIB}) {
  print OUT "use lib '$OPTIONS{LIB}';\n";
}
if ($OPTIONS{PREFIX}) {
  print OUT "use lib '$OPTIONS{PREFIX}/lib';\n";
}

print OUT <<'!NO!SUBS!';
use strict;
use Getopt::Long;

=head1 OPTIONS

  --database <dbname>    Name of the database to use
  --available_dbs        List of available chado databases
  --all_tags             List of all parameters known about a database
  --has_tag <tag>        Returns 1 or 0 on stdout if 
                          the given parameter is available
  --get_tag_value <tag>  Returns the value for the given tag
  --confdir              Returns the path for the configuration files
  --tmpdir               Returns the tmp directory path
  --gmod_root            Returns the gmod_root path
  --user                 Returns the username for the database
  --password             Returns the password for the database
  --host                 Returns the host name for the database
  --port                 Returns the port number for the database
  --driver               Returns the database driver for the database 
  --name                 Returns the name of the database
  --sqlfile              Returns the full path to the DDL file for the database
  --organism             Returns the common name of the default organism

=cut

GetOptions(
  'available_dbs'   => \$AVAIL,
  'all_tags'        => \$ALL_TAGS,
  'has_tag=s'       => \$HAS_TAG,
  'get_tag_value=s' => \$GET_TAG_VALUE,
  'confdir'         => \$CONFDIR,
  'tmpdir'          => \$TMPDIR,
  'gmod_root:s'     => \$GMOD_ROOT,
  'user'            => \$USER,
  'password'        => \$PASSWORD,
  'host'            => \$HOST,
  'port'            => \$PORT,
  'driver'          => \$DRIVER,
  'name'            => \$NAME,
  'sqlfile'         => \$SQLFILE,
  'organism'        => \$ORGANISM,
  'database:s'      => \$DATABASE,
) or ( system ('pod2text', $0), exit -1);




my $gmod_conf = $ENV{'GMOD_ROOT'} || "/var/lib/gmod";

!NO!SUBS!
close OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
chdir $origdir;