[lug] cgi/perl question

Tkil tkil at scrye.com
Sun Apr 21 19:58:54 MDT 2002


>>>>> "jd" == j davis <j> writes:

jd> and lets say i type in blue..what do i need to do on the perl
jd> side to accept this value...i.e. the value get sent to the script
jd> like $var=blue then for my perl scrp can i just use $var to
jd> equal blue or do i need to tell perl to get the value like..
jd> $var = <> ....thanks

perldoc CGI

look at the section entitled:

   FETCHING THE VALUE OR VALUES OF A SINGLE NAMED PARAMETER:

(sorry for shouting, but it's their caps, not mine).

there are also some reasonably-good tutorials and introductions on the
web.  a quick google search on "perl cgi primer" gives quite a few.
there are categories on open directory devoted to this topic:

   http://directory.google.com/Top/Computers/Programming/Languages/Perl/WWW/Tutorials/

one of those looked pretty straightforward:

   http://www.cgi101.com/class/

i have a few cgi samples on my own site:

   http://slinky.scrye.com/~tkil/perl/#cgi

(note that the first one is currently broken.)  of these, my
line-numberer and the password checker (very very low-tech) both
accept incoming parameters.

some people will argue that the default CGI.pm is too large and
bloated.  that's somewhat true, and there is a "factored" family of
modules that allow you to load only the parts you need.  i strongly
discourage anyone from trying to roll their own, however.  (and, if
you really need speed, look at mod_perl.)

t.



More information about the LUG mailing list