×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Hey All, I'm new to Perl and cou

Hey All, I'm new to Perl and cou

Hey All, I'm new to Perl and cou

(OP)
Hey All,

I'm new to Perl and could surely use your help. I've created a script and placed it in my cgi-bin, however, I get the following error message instead: Premature end of script handler /data1/hm/harmani.com/cgi-bin/form.cgi

At present, my form is located at http://www.harmani.com/feedback/form.html

the following is my script:
#!/usr/local/bin/perl
&get_form_data();
&send_email;
&print_thankyou_paga;
sub get_form_data
{

#Get the input

read(STDIN, $buffer,$ENV{'Content_Length'} );

#Split the name-value pairs
@parirs=split(/&/, $buffer);
foreach $pair (@paris)

{

($name, $value)=split(/=/, $pair);
#Un-Webify plus signs and %-encoding

$value=~tr/+/ /;
$value=~s/%[a-fA-FO-9][a-fA-FO-9])/pack("C",
hex($!))/eg;
$value=~s/<!--(.|\n)*-->//g;
$FORM($name)=$value;
}
}
sub send_email
{
$to="ceo\@harmani.com";
open(MAIL, "/var/qmail/bin/qmail-inject -t $to") || die
("can't open sendmail");
print MAIL "From: $FORM{'email'}\n";
print MAIL "To: $to\n";
print MAIL "Subject: Form submission\n\n";
# print out the form results
print MAIL "Name: $FORM{'Name1'}\n";
print MAIl "Title: $FORM{'Title'}\n;
print MAIL "E-mail: $FORM{'Email'}\n;
print MAIL "Address: $FORM{'Address'}\n;
print MAIL "Gender: $FORM{'Gender'}\n;
print MAIL "Age: $FORM{'Age}\n;
print MAIL "Date of Birth: $FORM{'DOB'}\n;
print MAIL "How did you find out about Harmani?: $FORM{'Info1'}\n;
print MAIL "What is it that you like about Harmani?: $FORM{'Info2'}\n;
print MAIL "What would you like to see improved at Harmani?: $FORM{'Comment'}\n;
close (MAIL);
}
sub print_thankyou_page
{
print "Content-type: text/html\n\n";
print "<HTML>\n<HEAD>\n<BODY BGCOLOR=\"#FFFF99\">\n
</HEAD>";
print "<H3>Thank you</H3>\n\n";
print "<P>\n";
print "Thank you for your submission\n";
print "<P>\n";
print "<A HREF=\"http://www.harmani.com/glance.html\";>Return</A>to the home page\n";
}
print "</BODY<\n</HTML>";

RE: Hey All, I'm new to Perl and cou

I hope it is not this simple, but, I have been gone around looking for my sun glasses which were on my head.... so.....

This line,
&print_thankyou_paga;

appears to be trying to call a non-existent sub.  Maybe it needs to be
&print_thankyou_page;

The premature end of script header' complaint usually means that for some reason you are not sending the 'Content-type....' line back to the browser.  Either your code is blowing up before or you simply are not doing it.  In this case, upon a very superficial inspection, it appears you are not actually calling the sub that would create that output.

HTH


 
 
 keep the rudder amid ship and beware the odd typo

RE: Hey All, I'm new to Perl and cou

(OP)
Hi goboating,

I modified the sub script portion as you suggested, but I'm still getting the same error. I could surely use your help.

shake & bake

RE: Hey All, I'm new to Perl and cou

see your other thread on this same issue.


 
 
 keep the rudder amid ship and beware the odd typo

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close