Samik Raychaudhuri <> wrote in
news:ckook4$2pa$:
> Hello,
> I have quick question. I want to shwo a multiline die msg, and I am
> not getting it. I am trying:
> $sth=$dbh->prepare($querystr) || $class->{errstr}=DBI->errstr; die
> "Query: $querystr, ".DBI->errstr; AND
> $sth=$dbh->prepare($querystr) || {$class->{errstr}=DBI->errstr; die
> "Query: $querystr, ".DBI->errstr;}
>
> None works. What is the way?
> Regards.
Why do you want to write hard to read code?
Why don't you read the DBI docs?
The following is easy to read
$sth = $dbh->prepare($querystr)
or die $dbh->errstr;
Notice the $dbh.
Yours is not.
Life is much simpler if you use the appropriate amount of whitespace and
structure.
unless($dbh->prepare($querystr)) {
$class->{errstr} = $dbh->errstr;
die "Query: $querystr, ", $dbh->errstr;
}
Now, while I do hope this helps you, let me point out that you should
read the posting guidelines for this group before you post again. They
are posted here regularly, and can be found on the WWW:
http://mail.augustmail.com/~tadmc/cl...uidelines.html
Sinan.