Why is this dup failing under BSD?



I've been doing the following in order to use flock ie. covert a file
descriptor to a File Handle

my %hash;
my $hash = tie (%hash, 'DB_File', $listsDb, O_RDONLY|O_CREAT, 0644)
or
die "Cannot open $listsDb\n";

my $fd = $hash->fd;
open(DB_FH, "+<&=$fd") or die "dup $!";
flock (DB_FH, LOCK_SH) or die "flock: $!";


under BSD I get an error when I do this.

Can anybody tell me why?

.



Relevant Pages

  • Re: beginner trying to use Getopt::Long
    ... Now take a look at the third, fourth, and fifth keys in that hash. ... (which means enddate, starttime, and endtime, because those keys were ... die " program requires startdate argument \n"; ...
    (comp.lang.perl.misc)
  • Re: Request for code feedback
    ... or die "an error occurred while reading the config file: ... The variable $eagleuser has too large a scope. ... why not just use a hash? ...
    (perl.beginners)
  • Re: Perl code for comparing two files
    ... Hash: SHA1 ... chomp $line; ... or die "could not open $second_file: ... foreach my $key (sort keys ...
    (perl.beginners)
  • RE: Re: Perl code for comparing two files
    ... Hash: SHA1 ... I am writing a perl code which will takes 2 more files as ... or die "could not open ... foreach my $key (sort keys ...
    (perl.beginners)
  • Re: Properly displaying items from hash
    ... The program extracts the values after the -> delimiter of both files ... open my $hd, 'log_aa.txt' or die $!; ... for (sort keys %hash) { ...
    (perl.beginners)