in reply to Perl Security - Prevent SPAM

Hello! Welcome to the PerlMonks - you've come to the right place.

1. You don't need to include <br> inside <code> tag.
2. Parsing part is so crappy :) But don't worry - I used it too :)

Here is classic hello world script that will become your best friend from now on ...
#!perl use strict; # this is a MUST! use CGI; # so you don't parse it by hand my $query = CGI->new(); # my is because of strict pragma print $query->header(); # so you don't do it by hand print "Hello World!";
When you have something like that (inside $query you have an CGI object) you can easily get any post or get parameter passed to your script easily.
my $form = $query->Vars();
In this case, $form will contain a hashref of form fields. So if you want to say print value of field called "name" :
print $form->{name};
Now let's address your Show_Critical_Error() function :)

Add this to top of your script.
use CGI::Carp qw(fatalsToBrowser); .... .... if($error) { die "Error message"; }
And it will print a relatively nice error message to the browser ;)

I believe this is enough to get you started! There are many more things to learn, but take them one by one ...


Have you tried freelancing? Check out Scriptlance - I work there.

Replies are listed 'Best First'.
Re^2: Perl Security - Prevent SPAM
by jazzwill (Initiate) on Oct 07, 2005 at 03:04 UTC
    Thanks! I am new to the whole: my $variable and strict. Where do I get more info about them?

      Have a read through the Tutorial material starting with the "Getting Started with Perl" series.

      use strict; use warnings; are used to pick up errors, normally due to sloppy programming, like mistyping variable names and using variable before they are initialised. If there are errors of that sort in code you post here you are lible for a bit of a drubbing!


      Perl is Huffman encoded by design.
        Thanks to both of you for a big leap forward!
      documentation for perl comes with perl itself, there are unix-style man pages, and there is the 'perldoc' utility that you can use to get information, they are pretty self-explanatory.

      Perl documentation is also made available on http://perldoc.perl.org, try searching there for 'my' or 'strict' and you'll find more information.

      And .... Google is your friend