in reply to activestate opens files from commandline but not when executed as a cgi
Remember to add an "or die: $!" (or croak) after the open. That will write a useful message to the error log.
my $file = 'somedir/somefile.dat'; open FILE, "< $file" or die "Cannot open $file for reading: $!";
The problem is likely bad permissions. You run from the command line as a different set of permissions from the Web server. It's also possible that if you're running the file from a different location, your paths could be wrong and the system can't find the file specified.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: activestate opens files from commandline but not when executed as a cgi
by feanor (Initiate) on Jun 10, 2002 at 19:42 UTC | |
by jsprat (Curate) on Jun 10, 2002 at 20:17 UTC |