Hello Monks:
I am having problems saving some params to a file ( printing();)($file, look at the code). The funny thing is the when I run the code (>perl file.pl ) a file is created. This is what I get in the apache server error log "Cannot save file /var/www/html/datfiles/data.dat at /var/www/cgi-bin/results.pl line 48. ". Please help!
#file.pl
#!/usr/bin/perl
use strict;
use CGI::Cookie;
use CGI;
my $cgi = new CGI;
my $file = "/var/www/html/datfiles/data.dat";
print
$cgi->header( -cookie => new CGI::Cookie(-name => 'Cho
+colateChip',
-value=> $cgi-
+>param('color'),
-expires => 'T
+hu, 26-Sep-2002 00:00:00 GMT'#,
#-domain => 's
+tudents.byu.edu',
#-path => '/'
)
);
print
$cgi->start_html(-title => 'Results',
-bgcolor => $cgi->param('color'));
if ($cgi->param())
{
print
$cgi->center(
$cgi->h3("Hello: ".
$cgi->param('name')),
$cgi->p,
"The keywords are: ",join(", ",$cgi->param('words')),
$cgi->p,
"Your favorite color is: ",$cgi->param('color'));
}
printing();
print
$cgi->end_html();
sub printing
{
open(FILE, ">$file")|| die "Cannot save file $file ";
print "test";
print FILE $cgi->param('name');
print FILE join(", ",$cgi->param('words'));
print FILE $cgi->param('color');
close FILE;
}