0

I am having trouble getting this script to work, It seems to work fine locally but not on the server for 1 and 1.

The error I am getting is:

Can't find string terminator HERE anywhere before EOF

I also seem to be getting this error:

255 perl returned nonzero status

Status: 500

Content-type: text/html**

I am new to CGI, but I could not find anything online about this particular issue.

Here is the 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>

And here is the 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;
Community
  • 1
  • 1

1 Answers1

0

Your cgi file is not compiling because you have some trailing whitespace after the here-doc closing string HERE.

According to perldoc perlop #Quote-and-Quote-like-Operators in the <<EOF section:

The terminating string must appear by itself (unquoted and with no surrounding whitespace) on the terminating line.

To fix, just remove the extra whitespace characters.

xxfelixxx
  • 6,512
  • 3
  • 31
  • 38
  • I made the change and got this error: - 255 perl returned nonzero status Status: 500 Content-type: text/html quote.cgi: Bareword found where operator expected at /kunden/homepages/2/d654570224/htdocs/MrKittles/quote.cgi line 8, near "

    Item" quote.cgi: (Missing operator before Item?) quote.cgi: syntax error at /kunden/homepages/2/d654570224/htdocs/MrKittles/quote.cgi line 7, near "BODY>" [Wed Dec 14 23:15:44 2016] quote.cgi: Search pattern not terminated at /kunden/homepages/2/d654570224/htdocs/MrKittles/quote.cgi line 8. STDOUT OK STDERR OK

    – jkittle1209 Dec 15 '16 at 04:16
  • 1
    The line numbers from your error message do NOT match up with the code you provided above. Could you provide the actual code? – xxfelixxx Dec 15 '16 at 04:28
  • This is exactly my code. – jkittle1209 Dec 18 '16 at 22:40