Results 1 to 7 of 7

Thread: Why the html part does not print in this perl script?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow Why the html part does not print in this perl script?

    Hi guys i try to run this script but i get this error :

    Code:
    CGI Error
    The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
    
    
    Undefined subroutine &main::HTMLGetRequest called at c:\inetpub\wwwroot\cgi-bin\jukebox2006\textchat\pop.pl line 22.
    This is the way i call it:
    http://localhost/cgi-bin/jukebox2006...p.pl?name=ID11

    Could any one help me fix this error. I am run perl locally and using iis5 .Thanks


    Code:
    #!/usr/bin/perl
    
    &HTMLGetRequest;
    #these are the variable  recived from the edit box.We declare them here
    $fname=$rqpairs{"name"}; 
    
    
    # Set Your Options:
    $redirection = 0;       # 1 = Yes; 0 = No
    
    #Note: 
    # SONG LOCATIONS
    
    
    #Defult Subroutines
    
    &HTMLContentType; 
    
    
    print <<method;
    
    <html>
    
    <head>
    
    <title> Music</title>
    </head>
    
    <frameset framespacing="0" border="0" rows="85,70,*" frameborder="0">
      <frame name="top" scrolling="no" noresize target="middle" src="http://localhost/jukeboxwall.html">
      <frameset cols="92,300,40%">
      <frame name="middle" target="bottom" src="http://localhost/jukeboxwall.html" scrolling="no" noresize>
        <frame name="middle1" src="http://localhost/textchat/popjukebox.pl?name=$fname" scrolling="no" noresize>
        <frame name="middle2" src="http://localhost/jukeboxwall.html" scrolling="no" noresize>
      </frameset>
      <frame name="bottom" src="http://localhost/jukeboxwall.html" scrolling="no" noresize>
      <noframes>
    
    <body bgColor=#336699>
        
    </body>
    </html>
    
    
    
    
    method

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Why the html part does not print in this perl script?

    I don't think a Perl interpreter parses the raw HTML within it. I think you'd have to use Print to print all the HTML you need. Unlike PHP, I'm not sure if Perl does have a special Perl and HTML formatting tag (IE: <?php ?>).

    Perl isn't my thing :|

    chem

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Why the html part does not print in this perl script?

    cN is right... and in addition, I don't believe there are any perl tags. Just complete perl files, so the entire html would need to be in print statements.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Why the html part does not print in this perl script?

    No, both the previous posters are wrong. The HEREDOC syntax of your print is fine.

    The problem is that you don't import whatever module contains HTMLGetRequest. As a result, Perl emits an error. The web server thus receives no well-formed HTTP headers (these would be written by HTMLContentType) and complains about the violation of the CGI protocol.
    The solution is to import whatever module you need.
    Code:
    use CGI;
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: Why the html part does not print in this perl script?

    Thank u CornedBee for your nice reply. do u mean i need to insall any software to handel the html? could u tell me what module? furthermore do u mean i just put this line in my code : use CGI;

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Why the html part does not print in this perl script?

    I have no idea what module. Undoubtedly this code comes from some tutorial, right? So there must be the mention of a module somewhere in this tutorial.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Why the html part does not print in this perl script?

    Quote Originally Posted by CornedBee
    No, both the previous posters are wrong. The HEREDOC syntax of your print is fine.

    The problem is that you don't import whatever module contains HTMLGetRequest. As a result, Perl emits an error. The web server thus receives no well-formed HTTP headers (these would be written by HTMLContentType) and complains about the violation of the CGI protocol.
    The solution is to import whatever module you need.
    Code:
    use CGI;
    Ah... So you learn something new every day. I had assumed Perl would be very similar to PHP.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width