Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: JavaScript in CGI

by Speedy (Monk)
on Oct 29, 2002 at 20:17 UTC ( [id://208859]=note: print w/replies, xml ) Need Help??

in reply to JavaScript in CGI

Another very convenient format to use in CGI scripts is the "Here" document, as described, for example, in the Camel Book Programming Perl, 3rd edition, pp. 66-67. The glossary in that book comments that "in Perl here documents are just a fancy form of quoting."

In your case something like

print <<EOF; <p><h1>Your form was sent.</h1></p> <a href="javascript:history.back()">Back to the form</a> EOF

where the 'terminator' of the "here" document is defined by the word after the << and the text between that line and the terminating line (in this case
on a line by itself in the first column, followed immediately by a return) is printed unchanged, including the internal quotes AND the return at the end of each line (so you don't have to put the "\n" stuff in).

This format makes it much easier to work with HTML code in the midst of Perl, at least until you are ready for templates and separating the HTML display code entirely from the Perl logic.

Live in the moment

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-05-20 06:09 GMT
Find Nodes?
    Voting Booth?

    No recent polls found