Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Help required for CGI Script

by graff (Chancellor)
on Dec 27, 2012 at 17:41 UTC ( #1010557=note: print w/replies, xml ) Need Help??

in reply to Help required for CGI Script
in thread CGI Script Working fine from my command prompt but Shows Internal server error when called through browser

When you run it via a browser, does your script return "Hello, World!" to the browser, and does the file "/tmp/ac.txt" contain what you expected? Do you see the word "HI"? What does that file contain (what is the expected output from "autostatus -J aa-test-bx-dly")?

Since you are using "fatalsToBrowser", are you seeing any error messages? What do they say?

Your code only tries to print the first line of "/tmp/ac.txt" to the browser, but if the output begins with a blank line, that's all your program will send to the browser.

If the autostatus output contains angle brackets, then your browser will be trying to interpret it as HTML tags, and will probably not display any of it (because the data can't be parsed that way). In order to see the "autostatus" output presented, you may have to print a <pre> tag before printing the command output, and then print a </pre> tag afterwards.

Replies are listed 'Best First'.
Re^2: Help required for CGI Script
by Anonymous Monk on Dec 28, 2012 at 07:46 UTC
    The output expected is RUNNING or SUCCESS .. Also the file so created doesnt have any blank lines. Please guide me the solution. Thanks
      The solution is that you debug your program using the advice and links already provided in reply to your several posts. If you're unable or unwilling to do so consider speaking to your manager or team leader explaining the situation. Consider the code you've actually written, what it does and what you're attempting to do. Your "expected output" does not occur within your program., tutorials.
        I hav gone through all the links but havenot got the Solution.
      Also the output is

      Content-Type: text/html; charset=ISO-8859-1 Hello, world! HI TEST JOB aa-test-bx-dly

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010557]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2018-06-23 20:30 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (125 votes). Check out past polls.