[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Premature end of script headers

Posted on 2006-07-20
3
Medium Priority
?
483 Views
Last Modified: 2013-12-25
Hi,
   I am (trying) building dynamic forms in perl.

I use indigoperl - incs Apache, php, perl and mysql.

My task at the moment is to get one perl script talking to another. The idea is that one perl library file contains subroutine so that they can be called externally from a calling form.

The calling form should have html in it along with logic.

The calling form having required the perl file that holds the subroutines calls the appropriate subroutine. The routine then performs some magic - return html content to the calling form.

I get an error 500
checked the error log and found...

[Thu Jul 20 20:58:20 2006] [error] [client 127.0.0.1] Premature end of script headers: call.pl
[Thu Jul 20 20:58:20 2006] [error] [client 127.0.0.1] nlib.pl did not return a true value at C:/indigoperl/apache/cgi-bin/call.pl line 2.

Here is the code - very simple - it seemed.

######call.pl

#!perl
require "nlib.pl";
&thank_you;

######nlib.pl
#!perl
sub thank_you{
      print "Content-type: text/html\n\n";
      print "<HTML>\n";
    print "<HEAD>\n";
    print "<TITLE>Thank You!</TITLE>\n";
    print "</HEAD>\n";
    print "<BODY BGCOLOR=#FFFFCC TEXT=#000000>\n";
    print "<H1>Thank You!</H1>\n";
    print "\n";
    print "<P>\n";
    print "<H3>Your feedback is greatly appreciated.<BR>\n";
    print "<P>\n";
    print "</BODY>\n";
    print "</HTML>\n";
}


Howver. The idea would be that call.pl is the template holder of html/body until closing tags. In the middle of these tags would be calls to nlib to build the web page.

what appears to be something simple - is baffling me to the nth degree.

Checked the htdocs and found:
### Section 2: 'Main' server configuration
#ISEXT next 2 lines are need to allow execution of script in the root directory
AddHandler cgi-script .pl
AddHandler cgi-script .cgi

I even removed .pl from nlib.pl call in call.pl

I am stuck behind my simple mind.

I could use a hand if you have the time, please.





0
Comment
Question by:nigelbalcarres
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 2000 total points
ID: 17149608
nlib.pl needs to return true.  Traditionally, this is done by adding a

1;

to the end of the file

BTW, you should learn about heredocs, eg:

sub thank_you{
    print "Content-type: text/html\n\n";
    print <<EOF;
<HTML>
<HEAD>
<TITLE>Thank You!</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFCC TEXT=#000000>
<H1>Thank You!</H1>\n";

<P>
<H3>Your feedback is greatly appreciated.<BR>
<P>
</BODY>
</HTML>
EOF
}

1;

You should also improve your HTML skills by running the generated HTML through a HTML validator.  You'll find there are loads of errors.
0
 

Author Comment

by:nigelbalcarres
ID: 17149679
Thanks

 will give it a go. Very new to perl - Well, used it years and years ago - its like japanese at the moment.

0
 

Author Comment

by:nigelbalcarres
ID: 17149743
Yep - perfect!

I do use heredocs - the latter not a good example.

Thanks a million!!!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question