in reply to CGI Programming Style With Empty Params

I normally create a hash with default values, then map param('name') to hash{'name'}. The default may even be '' but this way I get no warnings.

Another way to handle this is to assign to the param, like
$q->param('subject') || $q->param(-name=>'subject', -value=>'no subject');

warning: 0 or '' is still false, so the default will step in
Tiago

Replies are listed 'Best First'.
Re: Re: CGI Programming Style With Empty Params
by blackjudas (Pilgrim) on Oct 13, 2001 at 06:16 UTC
    Thanks tstock, I can use your suggestion in the above code example, though I was trying to step away from that technique (using the hash map), I've used it before on occasion, but I thought there'd be a better way.