E
Eric
Hello,
This is a repost of sorts. The code below is putting the info in a
file, $mountsDBFile, but it's doing so in binary. The file has to be
humanly readable.
I got a couple of responses on this. Someone responded and said that
there are tools to translate the file, or I can write a Perl script to
run on the file. (I'm assuming they meant post processing of the
file.) I made desperate attempts to do the latter, but with no
success.
Does anyone know of any tools to do this, or how I would write a
script to interpret this file in humanly readable text? Again, I tried
everything I could come up with (too numerable to list here). I'm
afraid we don't have the time to rewrite the way Perl is dealing with
the database to write the info to the file in readable form.
Thanks in advance to all that respond.
Eric
=======================================
sub RequestMountPoint {
my $self = shift;
my $protocol = shift;
my $bldNum = shift;
my $mntPnt = undef;
my $mountsDBFile = $self->Env->HomeDir()."/mountsDB";
my $mntsDB = {};
unless (open SEMAPHORE, "> /tmp/mounts.lock") {
$self->Env->ReleaseMachines();
die "unexpected problem allocating semaphore";
}
flock SEMAPHORE, Fcntl::LOCK_EX;
tie( %$mntsDB, "MLDBM", $mountsDBFile, O_CREAT|O_RDWR, 0666,
$DB_File:B_BTREE );
my $mountPoint = $self->Config->MountPointCount();
for (my $label = 0; $label < $mountPoint; $label++){
$mntPnt = "xmnt".$label;
unless (defined($mntsDB->{$mntPnt})){
$mntsDB->{$mntPnt} = {
BldNum => $bldNum,
Protocol => $protocol,
RefCnt => 1,
};
last;
}
if (($mntsDB->{$mntPnt}->{BldNum} == $bldNum) and
($mntsDB->{$mntPnt}->{Protocol} eq $protocol)) {
$mntsDB->{$mntPnt}->{RefCnt}++;
last;
}
$mntPnt = undef;
}
my $ref = $mntsDB->{$mntPnt}->{RefCnt};
untie(%$mntsDB);
close(SEMAPHORE);
return $mntPnt, $ref;
This is a repost of sorts. The code below is putting the info in a
file, $mountsDBFile, but it's doing so in binary. The file has to be
humanly readable.
I got a couple of responses on this. Someone responded and said that
there are tools to translate the file, or I can write a Perl script to
run on the file. (I'm assuming they meant post processing of the
file.) I made desperate attempts to do the latter, but with no
success.
Does anyone know of any tools to do this, or how I would write a
script to interpret this file in humanly readable text? Again, I tried
everything I could come up with (too numerable to list here). I'm
afraid we don't have the time to rewrite the way Perl is dealing with
the database to write the info to the file in readable form.
Thanks in advance to all that respond.
Eric
=======================================
sub RequestMountPoint {
my $self = shift;
my $protocol = shift;
my $bldNum = shift;
my $mntPnt = undef;
my $mountsDBFile = $self->Env->HomeDir()."/mountsDB";
my $mntsDB = {};
unless (open SEMAPHORE, "> /tmp/mounts.lock") {
$self->Env->ReleaseMachines();
die "unexpected problem allocating semaphore";
}
flock SEMAPHORE, Fcntl::LOCK_EX;
tie( %$mntsDB, "MLDBM", $mountsDBFile, O_CREAT|O_RDWR, 0666,
$DB_File:B_BTREE );
my $mountPoint = $self->Config->MountPointCount();
for (my $label = 0; $label < $mountPoint; $label++){
$mntPnt = "xmnt".$label;
unless (defined($mntsDB->{$mntPnt})){
$mntsDB->{$mntPnt} = {
BldNum => $bldNum,
Protocol => $protocol,
RefCnt => 1,
};
last;
}
if (($mntsDB->{$mntPnt}->{BldNum} == $bldNum) and
($mntsDB->{$mntPnt}->{Protocol} eq $protocol)) {
$mntsDB->{$mntPnt}->{RefCnt}++;
last;
}
$mntPnt = undef;
}
my $ref = $mntsDB->{$mntPnt}->{RefCnt};
untie(%$mntsDB);
close(SEMAPHORE);
return $mntPnt, $ref;