Newbie cgi problem - repost

Discussion in 'Perl' started by Little Monster, May 2, 2004.

  1. 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
    --
    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!
    Little Monster, May 2, 2004
    #1
    1. Advertising

  2. Little Monster

    Joe Smith Guest

    Little Monster wrote:

    > 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
    Joe Smith, May 2, 2004
    #2
    1. Advertising

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

    that will probably fix it...

    "Little Monster" <> wrote in message
    news:...
    > 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
    > --
    > 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!
    The Durban Towel, May 3, 2004
    #3
  4. On Sun, 02 May 2004 18:55:48 -0700, the world was enlightented by The
    Durban Towel, unto whom the words are attributed:

    > 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
    Little Monster, May 6, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Programatix
    Replies:
    1
    Views:
    374
    Kathleen Dollard
    Jul 17, 2003
  2. Jack

    Newbie Question (repost)

    Jack, Oct 17, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    289
    Karl Seguin [MVP]
    Oct 17, 2006
  3. Keith P Hodges

    Hosting Ruby scripts/cgi (repost)

    Keith P Hodges, Jul 11, 2004, in forum: Ruby
    Replies:
    3
    Views:
    187
    Aredridel
    Jul 20, 2004
  4. Luigi Ma
    Replies:
    0
    Views:
    124
    Luigi Ma
    Nov 21, 2007
  5. BestFriend
    Replies:
    2
    Views:
    744
Loading...

Share This Page