using $allowed = ($username eq 'admin');
how do I check for allowed? with 1 :0 I can do if ($allowed), do I need to do
if ($allowed eq "true")? If yes it's a little longer to write:-)

Etienne

Jeff 'japhy' Pinyan wrote:

> On Oct 30, Me said:
>
> >> > $allowed = $username eq 'admin' ? 1 : 0;
> >> >
> >> > $allowed = 1 if $username eq 'admin';
> >>
> >> FWIW, that statement by itself has no relationship to mod_perl.
> >
> >Well, I think the point is that mod_perl doesn't reset the value
> >of variables between runs so the second line may not do what
> >the programmer intended in a mod perl environment.
>
> It's true that globals don't get reset.  However, the line could simply be
> written as:
>
>   $allowed = ($username eq 'admin');
>
> and be done with it.  The equality returns true or false.
>
> --
> Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
> RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
> ** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to