why?

 
Post new topic   Reply to topic    Aprelium Forum Index -> Perl
View previous topic :: View next topic  
Author Message
netro
-


Joined: 09 Aug 2003
Posts: 8

PostPosted: Thu Aug 21, 2003 1:24 am    Post subject: why? Reply with quote

hi i use this:#!/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI::Carp qw(fatalsToBrowser);

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/\n/ /g; # replace newlines with spaces
$value =~ s/\r//g; # remove hard returns
$value =~ s/\cM//g; # delete ^M's
$FORM{$name} = $value;
}

open(OUTF,">>c:/survey.out") or dienice("Couldn't open survey.out for writing: $!");

# This locks the file so no other CGI can write to it at the
# same time...
flock(OUTF,2);
# Reset the file pointer to the end of the file, in case
# someone wrote to it while we waited for the lock...
seek(OUTF,0,2);

print OUTF "$FORM{'name'}|$FORM{'email'}|";
print OUTF "$FORM{'howreach'}|$FORM{'rating'}|";

%boxes = ( "des" => "Website Design",
"svr" => "Web Server Administration",
"com" => "Electronic Commerce",
"mkt" => "Web Marketing/Advertising",
"edu" => "Web-Related Education" );

foreach $key (keys %boxes) {
if ($FORM{$key} == 1) {
print OUTF "$key,";
}
}

print OUTF "|$FORM{'comments'}\n";
close(OUTF);

print <<EndHTML;
<html><head><title>Thank You</title></head>
<body>
<h2>Thank You!</h2>
Thank you for your feedback.<p>
<a href="index.html">Return to our home page</a><p>
</body></html>
EndHTML

sub dienice {
my($msg) = @_;
print "<h2>Error</h2>\n";
print $msg;
exit;
}

and get this:

Content-type: text/html
Software error:
flock() unimplemented on this platform at survey.cgi line 21.

For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

why wont it work?
Back to top View user's profile Send private message
jtc970
-


Joined: 24 Mar 2003
Posts: 172

PostPosted: Thu Aug 21, 2003 2:04 am    Post subject: Reply with quote

what operating system you using?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Thu Aug 21, 2003 3:38 pm    Post subject: Re: why? Reply with quote

flock() doesn't work on your system (it seems to be Win 95/98/Me). The only solution is to comment the lines containing the flock() statements.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
netro
-


Joined: 09 Aug 2003
Posts: 8

PostPosted: Thu Aug 21, 2003 6:14 pm    Post subject: Reply with quote

thats right i am using win 98 thanks for the tips il try it :D
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Perl All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group