HANG ON :) Brain kicked into gear after I sent the last message.
open() returns a positive value if it succeeds ...what you want is
|
|
V
unless(open(LOG,">$logfile")) {
print "Content-type: text/html\n\n";
print "Couldn't open $logfile. $!\n";
print "At $date, $ENV{'REMOTE_HOST'} couldn't enter the site.";
exit;
}
print LOG "At $date, $ENV{'REMOTE_HOST'} came here using
$ENV{'HTTP_USER_AGENT'}.\n";
close (LOG);
}
-----------------------------------------
Craig Moynes
Internship Student
netCC Development
IBM Global Services, Canada
Tel: (905) 316-3486
[EMAIL PROTECTED]
Nichole
Bialczyk To: [EMAIL PROTECTED]
<[EMAIL PROTECTED]> cc:
Subject: Re: writing to a text file ...
sorry
05/31/01 02:33
PM
i'm sorry. i didn't think that you guys would want me to include my code.
i just assumed that i should try to make my question to the point with as
little text as possible. i am still having the same problem (and i do
have the "). here is my exact code:
sub log {
if (open(LOG,">$logfile")) {
print "Content-type: text/html\n\n";
print "Couldn't open $logfile. $!\n";
print "At $date, $ENV{'REMOTE_HOST'} couldn't enter the site.";
exit;
}
print LOG "At $date, $ENV{'REMOTE_HOST'} came here using
$ENV{'HTTP_USER_AGENT'}.\n";
close (LOG);
}
$logfile was declared at the beginning of my script:
my $logfile = "/afs/umr.edu/users/nmb/tmp/nmb.txt";
again, any help is most appreciated.
nichole
On Thu, May 31, 2001 at 02:29:36PM -0400, Stephen P. Potter wrote:
> Lightning flashed, thunder crashed and "Nichole Bialczyk" <[EMAIL PROTECTED]>
whisper
> ed:
> | if(! open(LOG, ">xxx.txt)) {
>
> I really hate to pick on you, but if you are going to provide sample
code,
> please make sure you are providing exactly what is in the script
> (cut'n'paste as opposed to retyping). What you show above is a syntax
> error, you are missing a " after xxx.txt.
>
> -spp