Make HTML Beautiful

CGI.pm defines functions that emit HTML. The page is easier to read and write than raw HTML*

* if you speak Perl!

An Ordered List in Straight HTML

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head><title>Vegetables</title>
</head><body>
<h1>
        Eat Your Vegetables
</h1>
<ol>
        <li>
                peas
        </li>
         <li>
                broccoli
        </li>
         <li>
                cabbage
        </li>
         <li>
                peppers <ul>
                        <li>
                                red
                        </li>
                         <li>
                                yellow
                        </li>
                         <li>
                                green
                        </li>
                </ul>
        </li>
         <li>
                kolrabi
        </li>
         <li>
                radishes
        </li>
</ol>
<hr></body></html>

The Same thing Using CGI.pm

Script 1: vegetables1.pl


 #!/usr/bin/perl
 # Script: vegetables1.pl

 use CGI ':standard';

 print header,
    start_html('Vegetables'),
    h1('Eat Your Vegetables'),
    ol(
       li('peas'),
       li('broccoli'),
       li('cabbage'),
       li('peppers',
	  ul(
	     li('red'),
	     li('yellow'),
	     li('green')
	     )
	  ),
       li('kolrabi'),
       li('radishes')
       ),
    hr,
    end_html;

What it Looks Like

http://your.host/cgi-bin/vegetables1.pl
<< Previous Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Thu Oct 19 17:29:50 EDT 2000