in reply to checking for null variables
Do not parse CGI input data by hand. There is a perfectly good module that does it for you. Example:
use CGI qw(:standard); my $param1 = param('param1'); my $param2 = param('param2'); if(! defined($param1) ) { # Run the following code if $param1 is null die "param1 is null!\n"; } if(! defined($param2) ) { # Run the following code if param2 is null die "param2 is null!\n"; }
Update: Added :standard import for CGI.pm, as per merlyn's suggestion (oops).
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: checking for null variables
by merlyn (Sage) on Apr 15, 2003 at 18:34 UTC |