On 3/12/06, Elliot Holden <[EMAIL PROTECTED]> wrote:

> for some reason or another, my script won't create the text file that it
> is supposed to create on the server. For example, I'm taking a survey
> and calculating votes for a favorite song. The script IS calculating the
> votes so the text file is being created somewhere, but the text file is
> not showing up in the "cgi" directory where the script is located.

It's good security to not allow a program to write to the script
directory. It's better to have one directory for programs and a
different one for their data.

Since you didn't include any source code, I'll put on my ESP hat to
see.... Are you using relative path names for files in your CGI
program? That is, you're not saving this file as something like
'fred.dat' in the current working directory, are you? There's no
telling where the current working directory will be, in a CGI program;
the spec doesn't specify, alas. Either chdir() first to some absolute
directory path, or use full path names for all files, or both.

> This is a basic script that I followed
> out of a beginners book, so I know everything is correct in the script

Please do not be offended, but: Words alone cannot convey how humorous
I find that claim. :-)   Programs found in Perl books are at least as
reliable as investment advice found in books about becoming wealthy,
or recipes found in a book about losing weight. (Have you checked the
publisher's website for errata? My books have plenty, alas.) And even
if the program worked perfectly on the day that the books came rolling
off the presses, there are dozens of things that could make it break
today. CGI programs are even somewhat worse than the average Perl
program in this regard, because they're subject to the server's
configuration which may include security restrictions.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to