>On Tuesday, November 01, 2005 Chris Devers wrote: 
>>On Tue, 1 Nov 2005 [EMAIL PROTECTED] wrote:
>> from Perl Best Practices
>> 
>> use
>> 
>>    my $action = param('form_action') | | q{ }
>> 
>> instead of
>> 
>>    or ' '
>
>Good catch. Yes, that's clearer than simple apostrophes.
>
>However, you probably didn't really mean | | over ||, right ? :-)
>
>I still think 'or' is clearer than '||' for this kind of thing, but if 
>PBP had a different rationale I can't remember what it was...

My understanding is that you use || because it's more tightly bound than
'or'.  Although I would suggest something further for this:

my $action 
    = defined( param('form_action') ) 
        ? param('form_action') 
        : 'default_value'
    ;

This way if zero is a valid value for the form_action parameter it will
still pass through. Depends how you're doing things really.

Further, Data::FormValidator might be of interest in the future.

--
Dave Doyle

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to