----- Original Message -----
From: Tim Bunce <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 5:27 PM
Subject: (Fwd) BUG in Module DBI?


> ----- Forwarded message from Jens Ott <[EMAIL PROTECTED]> -----
>
> X-Authentication-Warning: hamilton.bonn-event.de: Host
>                           p3E9B9E42.dip.t-dialin.net [62.155.158.66]
claimed
>                           to be jens
> From: Jens Ott <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: BUG in Module DBI?
> Date: Sun, 15 Apr 2001 02:28:13 +0200
>
> Hi Tim Bunce,
>
> I found your name as the author of the perl-module DBI, that's why I'm
mailing to you.
> Maybe I found a bug in the modul (or maybe I'm just too stupid to use it
correctly :(  !)
>
> I tried the following:
> == snip ==
> my $statement = "SELECT user, session FROM benutzer WHERE session_key= ?";
> my $sth = $dbh->prepare($statement) || &error('SQL', $dbh->errstr);;
> my $success = $sth->execute($sk);
> my ($user, $session) = $sth->fetchrow_array  || &error('SQL',
$sth->errstr);
> == end snip ==
>
> In that way only the scalar $user was set and contained the value of
"session" from the database.

The or || operator is boolean left and right hand, so it forces scalar
context on both sides.
Therefor you get a scalar on your left hand assignment rather than a list.
This also occurs when assigining to a hash.
So it is not a bug, it is merely a choiche of operator.

Reply via email to