On Mon, 2 Jul 2001, James Kelty wrote:

> I can't seem to find any info on CGI.pm's ability to write tables. Does
> it have the ability? Or do I have to write it in raw html first add add
> CGI.pm elements to it?

It's in the docs.  CGI.pm has some very cool things you can do with
tables and rows using a neat distributive trick:

use CGI qw/:standard :html3/;
print table({-border=>undef},
        caption(strong('When Should You Eat Your Vegetables?')),
        Tr({-align=>CENTER,-valign=>TOP},
        [
           th(['','Breakfast','Lunch','Dinner']),
           th('Tomatoes').td(['no','yes','yes']),
           th('Broccoli').td(['no','no','yes']),
           th('Onions').td(['yes','yes','yes'])
        ]
      )
);

This produces:

<table border="1"><caption><strong>When Should You Eat Your
Vegetables?</strong></caption>
<tr ALIGN="CENTER" VALIGN="TOP"><th></th> <th>Breakfast</th>
<th>Lunch</th> <th>Dinner</th></tr>
<tr ALIGN="CENTER" VALIGN="TOP"><th>Tomatoes</th><td>no</td> <td>yes</td>
<td>yes</td></tr>
<tr ALIGN="CENTER" VALIGN="TOP"><th>Broccoli</th><td>no</td> <td>no</td>
<td>yes</td></tr>
<tr ALIGN="CENTER" VALIGN="TOP"><th>Onions</th><td>yes</td> <td>yes</td>
<td>yes</td></tr>
</table>

For more details, see

http://stein.cshl.org/WWW/software/CGI/cgi_docs.html

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
It is illegal to drive more than two thousand sheep down Hollywood
Boulevard at one time.

Reply via email to