
Jasmine
Administrator
Apr 7, 2001, 12:35 PM
Post #5 of 7
(10009 views)
|
sleuth, you don't need to use the $in = param('whatever') -- you can use the syntax that zanardi offered above:
my %in = map {$_ => param($_)} param(); Now all of the input is in %in. I'm not sure what you meant about " not letting you get away with ?name=This is some text & more text" As for the 3 stages noted about attitude towards CGI.pm... well, I would tend to disagree with that. Step 3 said "Knows enough to not use CGI.pm". And in response, I offer that: CGI.pm is used in nearly all of http://column about converting HTML to CGI.pm With the exception of browser output that's just a couple of lines (like a counter), CGI.pm is used exclusively in the newly published book, Writing CGI Applications with Perl, by Kevin Meltzer and Brent Michalski. I would say that the above people know enough about Perl, and advocate CGI.pm's use "anyway". I couldn't sum it up better than Ovid's use CGI or die; node on PerlMonks. Just read it It seems like a good percentage of the questions posted on this forum can be answered simply by pointing a user to the appropriate CGI.pm function. To wit: - How do I set/retrieve cookies? (cookie) - How do I upload files/why isn't my upload code working? (start_multipart_form) - Why isn't my page showing in Netscape? (table) - How do I redirect to another page? (redirect) - Why am I getting premature end of script headers? (header) - How do I have a multi-page form? (hidden) I love the shortcuts, particularly the html shortcuts. I don't know about anyone else, but I recall the days when the program is "done", it works beautifully, then to realize that the output looks funky in one browser or the other. CGI.pm helps you focus on Perl programming, not HTML coding. But, if someone is intending to use just less than a handful of functions, or for a simple program whose sole purpose is to output one or two lines to the browser, I agree that CGI.pm is overkill. On the flip side, if you became a bit more familiar with CGI.pm, you may realize that a lot of things that you're doing manually can be handled by CGI.pm. "CGI programming" inherently means that HTML code will be included. Passing off the HTML to CGI.pm sounds logical because we're programming Perl, and we shouldn't have to waste brain energy on trying to remember if the table tag, list, div, etc. was closed. Because I use CGI.pm so frequently, I've tossed together a quick reference of its functions. You can see/use it at <A target="_blank" HREF=http://nwark.pm.org/pm/reference/CGI-pm/allbyname.shtml. CGI.pm -- kid tested, mother approved.
|