Newbie cgi problem - repost

L

Little Monster

Hi all, sending this again since went missing first time - apologies if
appearing twice.

I have a very simple perl script acting as a placeholder for one that will
return "verses" from a book, which is a text file.

The placeholder script is supposed to print a message saying that it
works, nothing more - I can't even get that right!

Afaict, I've done everything right - the link to the script is from a page
in a frame, with the target set as a different frame. It just calls the
script with:
<A href="cgi-bin/BookOfMonster-orig.pl" name="Test link"
target="Body">Test the script</A>

The script contains only one line, a print statement:

print "The request was successful!\nThis is a work in progress - just
testing at the moment!";

all on one line of course! It runs fine in a console.

I clicking the link, I get a message from the server saying (among other
things):
Sorry, there has been a page error
The server could not complete your request.
* The script or file you are trying to call may be incorrectly
written.

(you can have a look at http://www.the-monstruum.co.uk/Book_frames.html)

Afaict, I've done everything right, but this is my first attempt at perl
and at cgi, can anyone tell me what I'm doing wrong?

Thanks in advance,

Monster
 
J

Joe Smith

Little said:
The script contains only one line, a print statement:
print "The request was successful!\nThis is a work in progress - just
testing at the moment!";

Go look at the CGI docs. All CGI programs have to output CGI-compatible
headers before they output anything else. Since you do not output
"Content-type: text/plain\n\n" or "Content-type: text/html\n\n" your
script doesn't meet even the bare minimum requirements for CGI.
-Joe
 
T

The Durban Towel

put this in your script before you print anything to a browser:
print "content-type:text/html\n\n";

that will probably fix it...
 
L

Little Monster

put this in your script before you print anything to a browser:
print "content-type:text/html\n\n";

that will probably fix it...

Mmm, I did thanks - works beautifully now. Now collecting content for The
Book.

Next to get rid of the frames and make the script read xml for the new
format of The Book, and make a script that can read it and create the
index for The Book, save me editing /two/ documents for every verse!

But first I need to see if my host has the XML::parser module. Is there a
quick way to find that out?

Monster
--
I am the sexiest man in the UuuuKaaaayy
All the girls love me
And I will never grow Ooollldd
I am the sexiest man in the UuuKaaaay!

http://www.the-monstruum.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top