> -Original Message-
> From: Me [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 30, 2001 1:05 PM
> To: Bob Showalter; 'Etienne Marcotte'; [EMAIL PROTECTED]
> Subject: Re: $a = $b eq "" ? 1 : 0;
>
>
> > > $allowed = $username eq '
On Oct 30, Etienne Marcotte said:
>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:-)
Did you bother looking at what eq returns? It returns 1 or '', which
means
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;
> >>
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 li
> > $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 progra
> -Original Message-
> From: Etienne Marcotte [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 30, 2001 9:56 AM
> To: [EMAIL PROTECTED]
> Subject: $a = $b eq "" ? 1 : 0;
>
>
> $allowed = $username eq 'admin' ? 1 : 0;
>
> Can someone explain me this line? I don't get the ? 1 : 0 part
Thanks a lot
Reading this it's probably always better to use this way of assigning
values. This way it does not stays set to 1 if you decide to switch to
mod_perl later:-)
Etienne
[EMAIL PROTECTED] wrote:
> If the username is equal to admin, $allowed is assigned 1 or else it is
> assigned a va
If the username is equal to admin, $allowed is assigned 1 or else it is
assigned a value of 0.
Rex
-Original Message-
From: Etienne Marcotte [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 30, 2001 9:56 AM
To: [EMAIL PROTECTED]
Subject: $a = $b eq "" ? 1 : 0;
$allowed = $username eq