Not to mention, with some creative map use, you can create dynamic tables and such pretty easy, while not breaking the stylish print 'some','things','in','a','row'; :-)
use CGI;
my $cgi = CGI->new;
print $cgi->header,
$cgi->start_html('Times Tables'),
$cgi->table( { -border => 1 },
( map {
my $r = $_;
$cgi->Tr( ( map {
$cgi->td( $_ * $r ),
} 1 .. 50 ) ),
} 1..50 ) ),
$cgi->end_html;
And for the obfuscated lovers in all of us (some people would call the above obfuscated.. slackers:-)
use CGI;my$cgi=CGI->new;print##
$cgi->header=>$cgi->start_html#
('Times Tables')=>$cgi->table(#
{-border=>1}=>(map{my$r=$_;$cgi
->Tr((map{$cgi->td($_*$r)}1..50
))=>}1..50))=>$cgi->end_html;##
--
Casey
| [reply] |
I've run into a case where CGI.pm was a little too sticky. Still, it's really a good way to go, as you don't have to worry about updating code in a script somewhere when the HTML specification changes.
Has anyone tried the 3.0 alpha versions? They're supposed to be much smaller and much, much faster. | [reply] |
I agree. Sometimes the stickiness make a script to behave strange, especially if you have a muliple page form generation / evaluation script with hidden fields.
There is a good idea to try the 'override' flag on hidden fields if such a script behaves strange.
/Wonko
| [reply] |
Sticky Fields?!?
*pulling at my hair in despair, dropping to my knees*
So much to learn!!!
Roy Alan
"I quit; I concede. Tanj on your silly game!" -- Louis Wu
| [reply] |
Sticky fields is a CGI.pm facility which is useful when you have a CGI script which returns multiple forms; The script automatically fills in the old formfield data (i.e. the data that has already been posted)
This is wery useful if you want to keep track of the information the user has already entered in hidden fields, or if you have to resend a form because the user did something wrong
/wonko
| [reply] |