Dear Anish,

AFAICT this is not a perl problem, but errors in your code are hindering
discovering why.

The cause of the problem is VERY LIKELY to be that the script is run
with minimum permissions, under a different user and possibly restricted
to below a certain subdirectory.

It should be "or die", not "|| die" due to different precedence of "or" vs "||".

You should check the final close, and perhaps even the prints.  CGI
scripts be as robust as you can make them.

Note you also have a race condition.  If the file does not exist, then
the file is created BEFORE this script reaches open, then you will
have two scripts writing to the same file at the same time.

Taint mode (-T) should be used for CGI scripts.  Definitely strict and
warnings, strict disables a few things that are potentially dangerous
in a CGI script with untrusted input.  Taint mode goes even further.

Also consider where you want to display your errors.  Usually, if you die
in a CGI script then the server logs get the die message.  The user gets
500 - Internal Server Error and little else.

Jonathan Paton
-- 
#!perl
$J=' 'x25 ;for (qq< 1+10 9+14 5-10 50-9 7+13 2-18 6+13
17+6 02+1 2-10 00+4 00+8 3-13 3+12 01-5 2-10 01+1 03+4
00+4 00+8 1-21 01+1 00+5 01-7 >=~/ \S\S \S\S /gx) {m/(
\d+) (.+) /x,, vec$ J,$p +=$2 ,8,= $c+= +$1} warn $J,,

-- 
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