Mary Anderson wrote:
Hi All,

   I am running Perl 5.8.7 (ActivePerl) on a Windows XP platform.  I have
been unable to open files from a CGI.pm script.  Here is the offending code:


use CGI qw/:standard :html3 :netscape/;
use POSIX 'strftime';
use CGI::Carp('carpout');
open(LOG,">>.\guestbook.err")||
        die "couldn't open log. $!";

First, to represent a backslash inside double quotes, you need to specify it as two backslashes:

  ".\\guestbook.err"

Second, I would recommend that you never make assumptions about what the current directory is from within a CGI script. Always use full path names.


Here is the error message:

guestbook.pl: couldn't open log. Permission denied at
c:\inetpub\wwwroot\cgi-bin\guestbook.pl line 5

I have tried full path names with forward and backwards slashes.  Sigh, if
only I were in UNIX, the error message would be sensible and useful!

You would get the same message in Unix. The directory you're trying to write to is not writeable by the webserver process, or the log file exists, and is not writeable by the webserver process.


The same piece of code works ok in a .pl script without CGI.

Typically because the users are different.

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