Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: CGI Action call

by pryrt (Abbot)
on Mar 12, 2018 at 13:41 UTC ( [id://1210715]=note: print w/replies, xml ) Need Help??


in reply to Re^2: CGI Action call
in thread CGI Action call

?action=four&in=6 is not a labeled block of code in your CGI application. Those are parameters passed to the CGI. Your application could "handle" them by running an inline block of code, or by calling a function, or by completely ignoring them. You haven't provided an SSCCE, so we cannot know how you chose to handle them.

Speaking on the philosophical level, to "return" anything in a CGI environment, you print the headers and the "anything" to STDOUT: If your CGI is supposed to output HTML, then you print headers followed by HTML to STDOUT; if your CGI is supposed to output JSON, then print the headers followed by the JSON text; if your CGI is supposed to output an image, your script needs to print the headers then the (possibly-encoded) binary for the image; if your CGI is supposed to output an error message, your script needs to print headers then the error message. For the error condition, if you want the message to just be part of the normal response, then included it as part of the already-existing message: for example, give some normal HTML, but include a <p class=error>error message goes here</p> or similar at an appropriate location in the HTML output; or, in the case of an image, include your normal pixels for the image, but then overwrite some of the pixels with your error indicator, before printing the image bytes to STDOUT.

If this is not helpful, you are going to have to give an SSCCE and a better description of what your current code outputs, and how you'd like to modify that output under the conditions you will need to specify.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1210715]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found