in reply to testing a non-existant hash entry...how to handle

Could a better method be testing for the existence of a param, and defaulting if it doesnt exist?
if(!defined $q->param('page') { #add defaults here } else { #do taint checking here! }
.. are we talking two different parameters?

Replies are listed 'Best First'.
Re: Re: testing a non-existant hash entry...how to handle
by ropey (Hermit) on Mar 01, 2002 at 10:05 UTC
    If you have quite a lot of inputs it may be viable to read them in in one hit.
    my $query = new CGI; my %inputs = $query->Vars; # All params passed in now in hash # Now can just use exists check to see if we have it if(exists $input{'page'} && exists $input{'page'} ne '') { # Do stuff } else { }
    Now can just use the 'exists' check to find if you have a particular input Just another way of doing it....