in reply to Generalising Forms from CGI.pm
However, i would never use that in any of my code. The way i see it, using CGI.pm HTML generation methods IS my abstraction. Wrapping that into something else seems a bit silly. Have you tried HTML::Template yet? You might find that it is all you need. ;)my $thisrow; my @rows; my %fields = ( name => sub { textfield(-name=>$_[0],-size=>50,-maxlength=>80 +) }, email => sub { textfield(-name=>$_[0],-size=>50,-maxlength=>80 +) }, site_name => sub { textfield(-name=>$_[0],-size=>50,-maxlength=>80 +) }, descripton => sub { textfield(-name=>$_[0],-size=>50,-maxlength=>80 +) }, comments => sub { textarea(-name=>$_[0],-cols=>50,-rows=>10) }, ); foreach my $key (keys %fields) { $thisrow = td({-align=>'right',-valign=>'TOP'},$key) . td({-align=>'left',-valign=>'TOP'}, $fields{$key}->($key)) ; push(@rows,$thisrow); }
p.s. don't forget that hashes are not ordered - you might want to try a list of hashes instead
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Generalising Forms from CGI.pm
by clscott (Friar) on Feb 19, 2003 at 22:41 UTC |