Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: null values

by polettix (Vicar)
on May 26, 2005 at 12:10 UTC ( #460635=note: print w/replies, xml ) Need Help??


in reply to null values

I sometimes find it useful to define a wrapper function to set a default value:
sub defaulted_param { my ($param_name, $default_value) = @_; return $default_value unless defined $q->param($param_name); return $q->param($param_name); }
(assuming $q is global, of course).

Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

Don't fool yourself.

Replies are listed 'Best First'.
Re^2: null values
by mrborisguy (Hermit) on May 26, 2005 at 18:10 UTC

    For future reference, I believe, if I can remember right, that usually when $q->param($param_name); is used, a person is using mod_perl. In this case, you should always pass $q to the sub as well, otherwise bad things tend to happen (at least they always did for me!).

        -Bryan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://460635]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-11-28 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?