in reply to porting a script from cgi_handlers.pl to CGI.pm (was : use CGI.pm)
OK... Here's some suggestions.
#!/usr/local/bin/perl#!/usr/local/bin/perl -wT use strict;
for your header you can use the CGI.pm
CHANGEuse CGI; my $q = new CGI; print $q->header;
Not that it matters much in a script this small, but I would point you to Template Toolkit to seperate you markup from your code. Then you can replace all these print statments.
print "<H2 ALIGN=center>It's been sent!</H2>; print "<HR ALIGN=center>"; print "<IMG SRC=\"http://www.iupui.edu/~webtrain/Graphics/Photos/b +ora_bora.jpg\>"; ...
Here it looks like you're getting the query string. You can use CGI's param method.
TO@pairs = &url_decode(split(/[&]/, $request)); while ($pairs[$r]) { ($a,$b) = split(/[=]/,$pairs[$r++]); ($name = $b) if ($a eq 'name'); ($email = $b) if ($a eq 'email'); ...
$q->param('name') $q->param('email') ...
And as merlyn pointed out this is really bad
open (MAIL, "| mailx -s \"Web mail from $email!\" cholling\@iupui.edu");but when you turn on Taint checking this will not be allowed. This does not mean Taint checking is the be all, end all, you can unsafely untaint data. I would highly recommend Ovid Web programming with Perl course.
grep
|
grep> cd /pub grep> more beer |
|
|---|