If you are starting out in cgi, don't overlook "here docs" for printing out html manually from a cgi script. They are very handy, because they allow you to output html just as you would statically write it, and embed variables into it.
As an example, this will output code for a javascript popup
#!/usr/bin/perl
use warnings;
use CGI qw(:standard);
use strict;
print header();
print <<HERE;
<html>
<head>
<title>test of javascript</title>
<script language="JavaScript">
<!-- Begin
function launchwin()
{
window.open("../jspopup.html", "dialog", "width=300, height=250, scrol
+lbars=yes, resizable=yes");
}
// End -->
</script>
</head>
<body>
<center>
<form>
<input type=button value="Click here to try the JavaScript!"
onClick="launchwin()">
</form>
</center>
</body>
</html>
HERE
and here is a simple thank you page
print <<END_HTML;
Content-type: text/html
<HTML>
<HEAD> <TITLE>Thanks!</TITLE> </HEAD>
<BODY bgcolor="#ffffff"><br>
<P>Thanks for visiting our site : $username!</P>
</BODY>
</HTML>
END_HTML
I'm not really a human, but I play one on earth.
flash japh
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.