C_T has asked for the wisdom of the Perl Monks concerning the following question:
Now I've returned home and I uploaded the same script and the same text file to my website's server. Now when I run the script it fails with an error:
Error opening produce_items.txt! : No such file or directory at /html/cgi/eproduce.cgi line 24.
First of all, here's the code I'm using:
#===== Open the file containing our list of produce $filename = "produce_items.txt"; open(PRODUCE, $filename) || die "Error opening $filename! : $!\n ";
Someone suggested trying the full pathname, so I amended the code as follows:
#===== Open the file containing our list of produce $current_directory = $ENV{PWD}; $filename = "$current_directory" . "/" . "produce_items.txt"; open(PRODUCE, $filename) || die "Error opening $filename! : $!\n ";
This fails with the same error (well, slightly different... it says "/produce_items.txt" instead of "produce_items.txt").
The text file is in the same directory as the cgi file, by the way.
I know this is a CGI problem, not a Perl problem, but perhaps someone more experienced than I can see what I'm doing wrong?
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Slightly OT: Perl and CGI - reading a file
by jZed (Prior) on Mar 30, 2004 at 23:43 UTC | |
by C_T (Scribe) on Mar 30, 2004 at 23:46 UTC | |
by C_T (Scribe) on Mar 31, 2004 at 00:09 UTC | |
|
Re: Slightly OT: Perl and CGI - reading a file
by borisz (Canon) on Mar 30, 2004 at 23:43 UTC | |
by C_T (Scribe) on Mar 30, 2004 at 23:52 UTC | |
by tachyon (Chancellor) on Mar 31, 2004 at 02:33 UTC | |
by C_T (Scribe) on Mar 31, 2004 at 16:45 UTC | |
by tachyon (Chancellor) on Mar 31, 2004 at 23:37 UTC | |
by bart (Canon) on Mar 31, 2004 at 20:01 UTC |