Nik has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on Problem in data flow between a perl and a js file

Replies are listed 'Best First'.
Re: Problem in data flow between a perl and a js file
by olus (Curate) on Dec 28, 2007 at 12:24 UTC
    If you are lazy posting your questions, people will be lazy answering them, and probably ignore them.
    It has been said often that the post must have the relevant content so that it may be useful for others when browsing the monastery and using the search box before posting.

    You may find your answer by searching for 'premature'. There might be some well written topic descriptions to guide you.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Problem in data flow between a perl and a js file
by polettix (Vicar) on Dec 28, 2007 at 13:39 UTC
    Please take the time to report the problem in its full form here. It's something you owe to the community.

    Premature end of script headers can basically mean two things: that your script did not spit out anything, or that it printed something that cannot be considered an HTTP response.

    You aren't telling us the whole story, anyway, because your code fragment starts with a comment about $data being already set up. Did you make sure that you actually reach that point? Are you sure your program isn't exiting before? Are you sure that you don't print anything on standard output before? What steps did you take to try and debug this?

    Hey! Up to Dec 16, 2007 I was named frodo72, take note of the change! Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Io ho capito... ma tu che hai detto?
Re: Problem in data flow between a perl and a js file
by dsheroh (Monsignor) on Dec 28, 2007 at 16:22 UTC
    From a brief read of your comments on the other site, it sounds like you're sending back just the value of $data in response to the AJAX subrequest. Doing so would be incorrect. AJAX responses are complete HTTP responses and need to have the appropriate HTTP headers (most significantly Content-Type, but you may also want to set others depending on the situation) and a trailing newline sent prior to their body, just like any other content transferred via HTTP.

    Kinda vague, I know, but a) you haven't provided enough information yet to easily determine a more concrete answer and b) if you can't be bothered to show all relevant code, the text of the response you're currently trying to send (i.e., the value of $data plus anything else you're sending along with it), or even to repost your question here, then I'm not going to make the effort of looking that closely at your question or otherwise attempting to dig up the additional information required to provide a better answer.

      good man!

      okey since you want to see the script from beginning i redited my initial post so you have a full picture. I Hope things will be more clear now.
        this is much better man, thank you for clearing this up.
Re: Problem in data flow between a perl and a js file
by SFLEX (Chaplain) on Dec 28, 2007 at 12:13 UTC
    I believe the error you are getting "Premature end of script headers" is a HTML error and I don't see in you code where
    print end_html; is, ie (</body></html>).

    Hope that helps
      It's an HTTP error, not HTML.

      what made you think that he needed </html>? http is a communication protocol not a hyper text definition.

      it is more important for you to keep learning, instead of spitting wrong answers online and pissing off people.