in reply to Converting To CGI.PM
When converting A to B, you had better know B first. If you don't understand CGI.pm now, you are going to have a very rough time converting something to it. Why not go over Ovid's Web Programming With Perl Course now, and then come back to this after you have a few CGI skills under you belt? Besides, CGI scripts that allow end-users to muck with the file system are loaded guns waiting to go off. ("You'll shoot your eye out!")
In the meantime, here is a little CGI.pm script that i put together a while back that simply prints what params were sent to it. The part that prints the sent params is tricky ... i use the dreaded map statement in conjunction with CGI.pm's table methods -- those are probably the hardest methods in CGI.pm to learn, so don't sweat it if you don't get it. And please feel free to ask me questions. :)#!/usr/bin/perl -T use strict; use warnings; use CGI qw(:standard); # this print statement ripped from CGI docs ;) print header, start_html('A Simple Example'), h1('A Simple Example'), start_form, "What's your name? ", textfield('name'), p, "What's the combination?", p, checkbox_group( -name=>'words', -values=>['eenie','meenie','minie','moe'], -defaults=>['eenie','minie'] ), p, "What's your favorite color? ", popup_menu( -name=>'color', -values=>['red','green','blue','chartreuse'] ), p, submit('go'), end_form, ; if (param('go')) { print hr, "You submitted the following: ", table( {border => 1}, # here is that 'dreaded' map i warned about ;) map Tr( th({align=>'right'},$_),td[param($_)] ), param() ), ; } print end_html();
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)
|
|---|