J
Janna
Hello all,
I've convinced myself that the error message I'm getting from my Perl
script is sufficiently bizarre to ask for help here, but as always, it
may be that I'm making a stupid mistake as I'm fairly new to Perl.
I have a program that contains several blocks of code that are either
executed or not, depending on options specified in the command line or
through interaction with the user. Each of my 4 blocks involves
accessing a DBM file. I'll call the blocks LIT, CON, EXP, and ASSOC.
The order in which I just listed the blocks is the order in which they
appear in the program.
My problem is with the EXP block. At the beginning of the block is the
following code:
my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
my %exphash;
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die
"Cannot open this file $dbloc: $!\n";
Here's where it gets interesting. If the user specifies options such
that the EXP block is run by itself, or in any combination with the CON
and ASSOC blocks, everything's fine. If, however, the LIT block
executes, I get an error message that *starts with* "Cannot open this
file /data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db:" If the
program is running interactively, there's no further information. If
it's running with options specified at the command line, following the
colon in the original error message is "No such file or directory".
Here is some of the original code, for the first three blocks:
LIT block
unless ($litweight == 0 and $onehitlitweight == 0) {
#Open the BTREE with the publicationsmy $dbloc =
'/data3/mcleod.3/aldi/janna/candid/BUILD2/humanpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %pubhash;
my $pubdb = tie %pubhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
#Open the BTREE with totalpubs
my $totalloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/totalpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %totalpubhash;
my $totalpubdb = tie %totalpubhash, "DB_File", $totalloc,
O_RDWR|O_CREAT, 0640, $DB_BTREE or die "Cannot open $totalloc: $!\n";
undef $pubdb;
untie %pubhash;
undef $totalpubdb;
untie %totalpubhash;
}
CON block
unless ($conweight == 0) {
#Load BTREE of Homologene data.
my $dbloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/humanhomol.db';
my %homolhash;
my $homoldb = tie %homolhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
undef $homoldb;
untie %homolhash;
}
EXP block
unless ($expweight == 0) {
my %tissuehash;
foreach (my $count=0; $count<@exptissues; $count++) {
$tissuehash{$exptissues[$count]} = 1;}
# Load exphash
my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
my %exphash;
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open this file $dbloc: $!\n";
undef $expdb;
untie %exphash;
}
There's more code I can include if needed, and I've chopped out the
guts of each block where the operations with the hashes are performed.
That said...any insight?
I've convinced myself that the error message I'm getting from my Perl
script is sufficiently bizarre to ask for help here, but as always, it
may be that I'm making a stupid mistake as I'm fairly new to Perl.
I have a program that contains several blocks of code that are either
executed or not, depending on options specified in the command line or
through interaction with the user. Each of my 4 blocks involves
accessing a DBM file. I'll call the blocks LIT, CON, EXP, and ASSOC.
The order in which I just listed the blocks is the order in which they
appear in the program.
My problem is with the EXP block. At the beginning of the block is the
following code:
my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
my %exphash;
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die
"Cannot open this file $dbloc: $!\n";
Here's where it gets interesting. If the user specifies options such
that the EXP block is run by itself, or in any combination with the CON
and ASSOC blocks, everything's fine. If, however, the LIT block
executes, I get an error message that *starts with* "Cannot open this
file /data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db:" If the
program is running interactively, there's no further information. If
it's running with options specified at the command line, following the
colon in the original error message is "No such file or directory".
Here is some of the original code, for the first three blocks:
LIT block
unless ($litweight == 0 and $onehitlitweight == 0) {
#Open the BTREE with the publicationsmy $dbloc =
'/data3/mcleod.3/aldi/janna/candid/BUILD2/humanpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %pubhash;
my $pubdb = tie %pubhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
#Open the BTREE with totalpubs
my $totalloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/totalpubs.db';
$DB_BTREE->{'flags'} = R_DUP;
my %totalpubhash;
my $totalpubdb = tie %totalpubhash, "DB_File", $totalloc,
O_RDWR|O_CREAT, 0640, $DB_BTREE or die "Cannot open $totalloc: $!\n";
undef $pubdb;
untie %pubhash;
undef $totalpubdb;
untie %totalpubhash;
}
CON block
unless ($conweight == 0) {
#Load BTREE of Homologene data.
my $dbloc = '/data3/mcleod.3/aldi/janna/candid/BUILD2/humanhomol.db';
my %homolhash;
my $homoldb = tie %homolhash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open $dbloc: $!\n";
undef $homoldb;
untie %homolhash;
}
EXP block
unless ($expweight == 0) {
my %tissuehash;
foreach (my $count=0; $count<@exptissues; $count++) {
$tissuehash{$exptissues[$count]} = 1;}
# Load exphash
my $dbloc = "/data3/mcleod.3/aldi/janna/candid/BUILD2/humanexp.db";
my %exphash;
my $expdb = tie %exphash, "DB_File", $dbloc, O_RDWR|O_CREAT, 0640,
$DB_BTREE or die "Cannot open this file $dbloc: $!\n";
undef $expdb;
untie %exphash;
}
There's more code I can include if needed, and I've chopped out the
guts of each block where the operations with the hashes are performed.
That said...any insight?