我无法使这个脚本工作,它似乎在本地工作正常,但在1和1的服务器上没有。
我得到的错误是:
在EOF之前的任何地方都找不到字符串终结符
我似乎也遇到了这个错误:
255 perl返回非零状态
状态:500
内容类型:text / html **
我是CGI的新手,但我在网上找不到关于这个特定问题的任何内容。
这是HTML:
<div class="form"><h1>Free Quote</h1>
<form action="/quote.cgi">
First Name: <input type="text" name="fName" placeholder="John"> <br>
Last Name: <input type="text" name="lName" placeholder="Smith"><br>
<br>
Company: <input type="text" name="company" placeholder="Mr Kittles"><br>
Phone Number: <input type="text" name="number" placeholder="xxx-xxx-xxx"><br>
E-Mail: <input type="text" name="email" placeholder="Something@gmail.com"><br><br>
Tell us what you you are looking for:<br><br><textarea name="message" rows="10" cols="35" placeholder="Tell us all about your website. Include type of business, colors, current web address if possible, and anything else you think is relevant for us to do some research before we call you back."></textarea><br><br>
<input type="submit" value="Submit">
</form>
</div>
这是CGI
#! /usr/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use strict;
use warnings;
print "Content-type: text/html\n\n";
my $fName = param('fName');
my $lName = param('lName');
my $company = param('company');
my $number = param('number');
my $email = param('email');
print <<HERE;
<HTML>
<BODY>
<H3>Item has been registered and added to inventory.txt</H3>
HERE
open (INVENTORY, ">>tet.txt") or die "File error, $!";
print INVENTORY "$fName|$lName|$company|$number|$email\n";
close INVENTORY;
答案 0 :(得分:0)
您的cgi文件未编译,因为在here-doc结束字符串HERE
之后您有一些尾随空格。
根据<<EOF
部分中的perldoc perlop #Quote-and-Quote-like-Operators:
终止字符串必须单独出现(未加引号且没有周围的空格)。
要修复,只需删除多余的空白字符。