sulfericacid has asked for the wisdom of the Perl Monks concerning the following question:
The code below produces "Cannot open file 'db': Bad file descriptor". Can anyone tell me why and what this error really means?
My first thought was it couldn't find the file so I intentionally changed the file path to something I knew didn't exist and the error was different (file not found error). So it's actually finding the file but it's erroring out anyway.
The folder the DB is in is 755 and the database is 644. The CGI script is in cgi-bin/stats/ and the database is in cgi-bin/track/link.db .
Any help would be very much appreciated!
#!/usr/bin/perl use warnings; use strict; use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; use POSIX; use DB_File; my $db = "/home/spyders/public_html/cgi-bin/track/link.db"; my %db; tie %db, "DB_File", "$db", O_CREAT | O_RDWR, 0644, or die "Cannot open file 'db': $!\n"; foreach (%db) { print "$_ => $db{$_}<br>"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cannot open file 'db': Bad file descriptor
by PodMaster (Abbot) on Jan 23, 2005 at 11:36 UTC | |
|
Re: Cannot open file 'db': Bad file descriptor
by aquarium (Curate) on Jan 23, 2005 at 12:50 UTC |