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)

In reply to (jeffa) Re: Converting To CGI.PM by jeffa
in thread Converting To CGI.PM by lisaw

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.