This file is indexed.

/usr/share/gmod/chado/bin/pg2cdbi.pl is in chado-utils 1.31-3.

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

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
#!/usr/bin/env perl
# vim: set ft=perl ts=2 expandtab:

use strict;
use SQL::Translator;
use lib './bin';
use Skip_tables qw( @skip_tables );

unless ( scalar @ARGV > 3 ) {
  die "USAGE: $0 <dbname> <username> <password> <sql file> [<sql files>]\n";
}

my $db_name     = shift @ARGV;
my $db_username = shift @ARGV;
my $db_password = shift @ARGV;
my $dsn         = "dbi:Pg:dbname=$db_name";
my $translator  = SQL::Translator->new(
  from          => 'PostgreSQL',
  to            => 'ClassDBI',
  filename      => \@ARGV,
  producer_args => {
    db_user     => $db_username,
    db_pass     => $db_password,
    dsn         => $dsn,
  },
  filters       => [
                   sub {
                     my $schema = shift;
                     foreach (@skip_tables) {
                       $schema->drop_table($_);
                     }  
                   },
  ],
);

$translator->format_package_name(\&x);
$translator->format_pk_name(sub {return 'id';});
$translator->format_fk_name(\&y);

my $output = $translator->translate or die $translator->error;

print $output;

sub x { 
  my ($name, $primary_key) = @_;
  my $package_name;
  my @temp = split(/_/,$name);

  for(my $i = 0; $i < scalar(@temp); $i++) {
    my $new_name = ucfirst($temp[$i]);
    if($i == 0) {
      $package_name .= $new_name;
    } else {
      $package_name .= "_" .$new_name;
    }
  }

  $package_name = 'Bio::Chado::CDBI::' . $package_name;

  return $package_name;
}

sub y {
  my $table_name = shift;
  my $field_name = shift;
  $field_name =~ s/_id$//;
  return $field_name;
}