This is an attempt to flock a database, a modified version of a snippet of code from the PERL docs at http://www.perl.com/CPAN-local/doc/manual/html/lib/DB_File.html#HINTS_AND_TIPS
# begin code
$database = "/home/test/temp.dbm";
$db = tie(%hash, DB_File, $database, O_RDRW|O_CREAT, 0777) || die "Could not tie database!";
$fd = $db->fd;
open(DB_FH, "+<&=$fd") || die "dup ($!)"; # dies here
flock (DB_FH, 1);
flock (DB_FH, 8);
# end code
The error arises from the line: open(DB_FH, "+<&=$fd"). Now, I understand the concept behind "+<&$fd", but why would this open fail when the tie() did not? The script terminates without setting $!.
If anyone can answer this I would really appreciate it. Pardon any typos, its been a long weekend.